/** * Get the user record entry by username and password. * * @return mixed Array on success, otherwise FALSE */ public function getUserByEmailAndPassword($email = null, $password = null) { if ($email == '' || $password == '') { return false; } $res = $this->db->one($sql = "SELECT * FROM `{$this->mySqlTablePrefix}user` WHERE `id`=:email", array(':email' => $email)); if ($res) { if (password_verify($password, $res['password'])) { return $this->normalizeUser($res); } else { // Backwards compatibility: rehash old password $userObj = new User(); if ($res['password'] == $userObj->encryptPasswordDeprecated($password)) { $res['password'] = $userObj->encryptPassword($password); $this->postUser($res); return $this->normalizeUser($res); } } } return false; }