/**
  * Reset the given user's password.
  * 
  * @param  ResetPasswordRequest  $request
  * @return Response
  */
 public function postReset(ResetPasswordRequest $request)
 {
     $credentials = $request->only('email', 'password', 'password_confirmation', 'token');
     $response = Password::reset($credentials, function ($user, $password) {
         $this->resetPassword($user, $password);
     });
     switch ($response) {
         case Password::PASSWORD_RESET:
             return redirect()->to('/')->with('ok', trans('passwords.reset'));
         default:
             return redirect()->back()->with('error', trans($response))->withInput($request->only('email'));
     }
 }
示例#2
0
 /**
  * Reset the given user's password.
  *
  * @param  ResetPasswordRequest  $request
  * @return Response
  */
 public function postReset(Requests\Auth\ResetPasswordRequest $request)
 {
     $credentials = $request->only('email', 'password', 'password_confirmation', 'token');
     $response = $this->passwords->reset($credentials, function ($user, $password) {
         $user->password = bcrypt($password);
         $user->save();
     });
     switch ($response) {
         case PasswordBroker::PASSWORD_RESET:
             return $this->loginAndRedirect($request->email);
         default:
             return redirect()->back()->withInput($request->only('email'))->withErrors(['email' => trans($response)]);
     }
 }