| 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 | |