PasswordResetModel::saveChangedPassword PHP Method

saveChangedPassword() public static method

Writes the new password to the database
public static saveChangedPassword ( string $user_name, string $user_password_hash ) : boolean
$user_name string
$user_password_hash string
return boolean
    public static function saveChangedPassword($user_name, $user_password_hash)
    {
        $database = DatabaseFactory::getFactory()->getConnection();
        $sql = "UPDATE users SET user_password_hash = :user_password_hash\n                 WHERE user_name = :user_name\n                 AND user_provider_type = :user_provider_type LIMIT 1";
        $query = $database->prepare($sql);
        $query->execute(array(':user_password_hash' => $user_password_hash, ':user_name' => $user_name, ':user_provider_type' => 'DEFAULT'));
        // if one result exists, return true, else false. Could be written even shorter btw.
        return $query->rowCount() == 1 ? true : false;
    }