Changeset 19972 for events/phpframework

Show
Ignore:
Timestamp:
09/26/08 21:18:03 (5 years ago)
Author:
kenji
Message:

Add method to update password

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • events/phpframework/codeigniter/trunk/system/application/libraries/redux_auth.php

    r18733 r19972  
    224224                         
    225225                } 
    226                  
     226 
     227                /** 
     228                 * update password 
     229                 *  by Kenji Suzuki 
     230                 * 
     231                 * @access public 
     232                 * @param       string $username 
     233                 * @param       string $new_password 
     234                 * @return      bool 
     235                **/ 
     236                public function update_password($username, $new_password) 
     237                { 
     238                        $this->ci->db->select('hash'); 
     239                        $query = $this->ci->db->get_where('users', array('username' => $username)); 
     240                        $row = $query->row(); 
     241                 
     242                        if ($row->hash) 
     243                        { 
     244                                $data['password'] = sha1($this->salt. $row->hash . $new_password); 
     245                                return $this->ci->db->update('users', $data, array('username' => $username)); 
     246                        } 
     247                        else 
     248                        { 
     249                                return FALSE; 
     250                        } 
     251                } 
     252 
    227253                /** 
    228254                 * forgotten_begin