/**
  * Execute the job.
  *
  * @return void
  */
 public function handle(PasswordResetRepository $tokens)
 {
     $token = str_random(60);
     $tokens->store($this->email, $token);
     Mail::queue('emails.auth.password_reset', ['email' => $this->email, 'token' => $token], function ($m) {
         $m->to($this->email)->subject('Password Reset');
     });
 }
Esempio n. 2
0
 /**
  * Process request to reset password
  *
  * @param  App\Http\Requests\Auth\PasswordReset $request
  * @return Illuminate\Http\RedirectResponse
  */
 public function patchReset(PasswordReset $request)
 {
     $valid = $this->tokens->verify($request->email, $request->token);
     if (!$valid) {
         return redirect()->route('home')->withDanger(trans('auth.token_not_valid'));
     }
     User::where('email', $request->email)->update(['password' => bcrypt($request->password)]);
     $this->tokens->delete($request->email);
     return redirect()->route('auth.signin')->withSuccess("Password was changed successfully.");
 }