예제 #1
0
 /**
  * Resets the password of a user. The $input['token'] will tell which user.
  *
  * @param  array $input Array containing 'token', 'password' and 'password_confirmation' keys.
  *
  * @return boolean
  */
 public function resetPassword($input)
 {
     $result = false;
     $user = Confide::userByResetPasswordToken($input['token']);
     if ($user) {
         $user->password = $input['password'];
         $user->password_confirmation = $input['password_confirmation'];
         $result = $this->save($user);
     }
     // If result is positive, destroy token
     if ($result) {
         Confide::destroyForgotPasswordToken($input['token']);
     }
     return $result;
 }