src/CRUDlex/PasswordReset.php
public function resetPassword($token, $newPassword)
    {
        $passwordReset = $this->getValidPasswordReset($token);
        if ($passwordReset === null) {
            return false;
        }
        $user = $passwordReset->get('user');
        $user = $this->userData->get($user['id']);
        $user->set('password', $newPassword);
        $this->userData->update($user);

        $reset = gmdate('Y-m-d H:i:s');
        $passwordReset->set('reset', $reset);
        $this->passwordResetData->update($passwordReset);

        return true;
    }
public function resetPassword($token, $newPassword)
    {
        $passwordReset = $this->getValidPasswordReset($token);
        if ($passwordReset === null) {
            return false;
        }
        $user = $passwordReset->get('user');
        $user = $this->userData->get($user['id']);
        $user->set('password', $newPassword);
        $this->userData->update($user);

        $reset = gmdate('Y-m-d H:i:s');
        $passwordReset->set('reset', $reset);
        $this->passwordResetData->update($passwordReset);

        return true;
    }
public function resetPassword ( $ token , $ newPassword ) { $ passwordReset = $ this -> getValidPasswordReset ( $ token ) ; if ( $ passwordReset === null ) { return false ; } $ user = $ passwordReset -> get ( 'user' ) ; $ user = $ this -> userData -> get ( $ user [ 'id' ] ) ; $ user -> set ( 'password' , $ newPassword ) ; $ this -> userData -> update ( $ user ) ; $ reset = gmdate ( 'Y-m-d H:i:s' ) ; $ passwordReset -> set ( 'reset' , $ reset ) ; $ this -> passwordResetData -> update ( $ passwordReset ) ; return true ; }
Resets the password of an user belonging to the given password reset
token.

@param string $token
the password reset token
@param string $newPassword
the new password

@return boolean
true on success, false on failure with one of this reasons:
- no or more than one password reset request found for this token
- the password request for this token is older than 48h
- the password request for this token has already been used
Resets the password of an user belonging to the given password reset token .