示例#1
0
 /**
  * Attempt to reset a user's password.
  *
  * @return \Illuminate\Http\JsonResponse
  */
 public function attemptReset()
 {
     $credentials = $this->input(['username']);
     $token = $this->input('token');
     $input = $this->input(['password', 'password_confirmation']);
     try {
         $this->users->resetPasswordForCredentials($credentials, $input, $token);
         return $this->success(['password reset, please log in']);
     } catch (ReminderException $e) {
         return $this->error(['password could not be reset']);
     }
 }
示例#2
0
 /**
  * Attempt to reset a user's password.
  *
  * @return \Illuminate\Http\RedirectResponse
  */
 public function attemptReset()
 {
     $credentials = $this->input(['username']);
     $token = $this->input('token');
     $input = $this->input(['password', 'password_confirmation']);
     try {
         $this->users->resetPasswordForCredentials($credentials, $input, $token);
         return $this->redirect('login')->with('success', Lang::get('c::auth.reset-success'));
     } catch (ValidationException $e) {
         return $this->redirect('reset')->withInput()->withErrors($e);
     } catch (ReminderException $e) {
         if ($this->debug) {
             throw $e;
         }
         return $this->redirect('login')->with('error', Lang::get('c::auth.reset-token-invalid'));
     }
 }