ResetPasswordController.php 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. <?php
  2. namespace App\Http\Controllers\Auth;
  3. use App\Http\Controllers\Controller;
  4. use Illuminate\Foundation\Auth\ResetsPasswords;
  5. use Illuminate\Support\Facades\Password;
  6. use Illuminate\Support\Facades\Auth;
  7. use Illuminate\Http\Request;
  8. class ResetPasswordController extends Controller
  9. {
  10. /*
  11. |--------------------------------------------------------------------------
  12. | Password Reset Controller
  13. |--------------------------------------------------------------------------
  14. |
  15. | This controller is responsible for handling password reset requests
  16. | and uses a simple trait to include this behavior. You're free to
  17. | explore this trait and override any methods you wish to tweak.
  18. |
  19. */
  20. use ResetsPasswords;
  21. /**
  22. * Where to redirect users after resetting their password.
  23. *
  24. * @var string
  25. */
  26. protected $redirectTo = '/home';
  27. public function __construct()
  28. {
  29. $this->middleware('guest');
  30. }
  31. public function showResetForm(Request $request, $token = null)
  32. {
  33. return view('auth.passwords.reset_new')->with(
  34. ['token' => $token, 'email' => $request->email]
  35. );
  36. }
  37. public function broker()
  38. {
  39. return Password::broker('users');
  40. }
  41. /**
  42. * Get the guard to be used during password reset.
  43. *
  44. * @return \Illuminate\Contracts\Auth\StatefulGuard
  45. */
  46. // protected function guard()
  47. // {
  48. // return Auth::user();
  49. // }
  50. // protected function resetPassword($user, $password)
  51. // {
  52. // $user->password = Hash::make($password);
  53. // $user->setRememberToken(Str::random(60));
  54. // $user->save();
  55. // event(new PasswordReset($user));
  56. // //you should comment below and redirect any route you want like:
  57. // // return redirect('http://example.com');
  58. // //$this->guard()->login($user);
  59. // return redirect()->route('home');
  60. // }
  61. }