ResetPasswordController.php 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. <?php
  2. namespace App\Http\Controllers\Auth;
  3. use App\Http\Controllers\Controller;
  4. use Illuminate\Foundation\Auth\ResetsPasswords;
  5. use Illuminate\Support\Str;
  6. class ResetPasswordController extends Controller
  7. {
  8. /*
  9. |--------------------------------------------------------------------------
  10. | Password Reset Controller
  11. |--------------------------------------------------------------------------
  12. |
  13. | This controller is responsible for handling password reset requests
  14. | and uses a simple trait to include this behavior. You're free to
  15. | explore this trait and override any methods you wish to tweak.
  16. |
  17. */
  18. use ResetsPasswords;
  19. /**
  20. * Where to redirect users after resetting their password.
  21. *
  22. * @var string
  23. */
  24. protected $redirectTo = '/accounts';
  25. /**
  26. * Create a new controller instance.
  27. *
  28. */
  29. public function __construct()
  30. {
  31. $this->middleware('guest');
  32. }
  33. /**
  34. * Reset the given user's password.
  35. *
  36. * @param \Illuminate\Contracts\Auth\CanResetPassword $user
  37. * @param string $password
  38. * @return void
  39. */
  40. protected function resetPassword($user, $password)
  41. {
  42. $mciroUserService = resolve('microUserService');
  43. $user->password = $password;
  44. $user->remember_token = Str::random(60);
  45. $mciroUserService->update($user);
  46. return redirect('/login');
  47. }
  48. }