src/AuthManager.php
public function resetPassword($code, $password)
    {
        try {
            // Attempt to fetch the user via the activation code
            $reminder = $this->reminders
                           ->createModel()
                           ->newQuery()
                           ->where('code', $code)
                           ->where('completed', false)
                           ->where('created_at', '>', Carbon::now()->subSeconds(259200))
                           ->first();

            if (!$reminder) {
                $message = $this->translate("password_reset_problem", "Invalid or expired password reset code; please request a new link.");
                throw new InvalidArgumentException($message);
            }
            $user = $this->sentinel->findUserById($reminder->user_id);

            // Complete the user's password reminder
            $this->reminders->complete($user, $code, $password);

            // While we are here, lets remove any expired reminders
            $this->reminders->removeExpired();
        } catch (Exception $e) {
            return $this->returnException($e);
        }

        if ($user) {
            $message = $this->translate("password_reset_success", "Password reset successful.");
            return new SuccessReply($message);
        }

        $message = $this->translate('password_reset_failed', 'There was a problem reseting your password.');
        return new FailureReply($message);
    }
public function resetPassword($code, $password)
    {
        try {
            // Attempt to fetch the user via the activation code
            $reminder = $this->reminders
                           ->createModel()
                           ->newQuery()
                           ->where('code', $code)
                           ->where('completed', false)
                           ->where('created_at', '>', Carbon::now()->subSeconds(259200))
                           ->first();

            if (!$reminder) {
                $message = $this->translate("password_reset_problem", "Invalid or expired password reset code; please request a new link.");
                throw new InvalidArgumentException($message);
            }
            $user = $this->sentinel->findUserById($reminder->user_id);

            // Complete the user's password reminder
            $this->reminders->complete($user, $code, $password);

            // While we are here, lets remove any expired reminders
            $this->reminders->removeExpired();
        } catch (Exception $e) {
            return $this->returnException($e);
        }

        if ($user) {
            $message = $this->translate("password_reset_success", "Password reset successful.");
            return new SuccessReply($message);
        }

        $message = $this->translate('password_reset_failed', 'There was a problem reseting your password.');
        return new FailureReply($message);
    }
public function resetPassword ( $ code , $ password ) { try { // Attempt to fetch the user via the activation code $ reminder = $ this -> reminders -> createModel ( ) -> newQuery ( ) -> where ( 'code' , $ code ) -> where ( 'completed' , false ) -> where ( 'created_at' , '>' , Carbon :: now ( ) -> subSeconds ( 259200 ) ) -> first ( ) ; if ( ! $ reminder ) { $ message = $ this -> translate ( "password_reset_problem" , "Invalid or expired password reset code; please request a new link." ) ; throw new InvalidArgumentException ( $ message ) ; } $ user = $ this -> sentinel -> findUserById ( $ reminder -> user_id ) ; // Complete the user's password reminder $ this -> reminders -> complete ( $ user , $ code , $ password ) ; // While we are here, lets remove any expired reminders $ this -> reminders -> removeExpired ( ) ; } catch ( Exception $ e ) { return $ this -> returnException ( $ e ) ; } if ( $ user ) { $ message = $ this -> translate ( "password_reset_success" , "Password reset successful." ) ; return new SuccessReply ( $ message ) ; } $ message = $ this -> translate ( 'password_reset_failed' , 'There was a problem reseting your password.' ) ; return new FailureReply ( $ message ) ; }
Attempt a password reset
@param  string $code
@param  string $password
@return Reply
Attempt a password reset