ForgotPasswordController.php 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. <?php
  2. namespace App\Http\Controllers\Auth;
  3. use App\Http\Controllers\Controller;
  4. use Illuminate\Foundation\Auth\SendsPasswordResetEmails;
  5. use App\Services\BouncerService;
  6. use Illuminate\Http\Request;
  7. class ForgotPasswordController extends Controller
  8. {
  9. /*
  10. |--------------------------------------------------------------------------
  11. | Password Reset Controller
  12. |--------------------------------------------------------------------------
  13. |
  14. | This controller is responsible for handling password reset emails and
  15. | includes a trait which assists in sending these notifications from
  16. | your application to your users. Feel free to explore this trait.
  17. |
  18. */
  19. use SendsPasswordResetEmails;
  20. /**
  21. * Create a new controller instance.
  22. *
  23. * @return void
  24. */
  25. public function __construct()
  26. {
  27. $this->middleware('guest');
  28. }
  29. /**
  30. * Display the form to request a password reset link.
  31. *
  32. * @return \Illuminate\View\View
  33. */
  34. public function showLinkRequestForm()
  35. {
  36. if(config('pixelfed.bouncer.cloud_ips.ban_logins')) {
  37. abort_if(BouncerService::checkIp(request()->ip()), 404);
  38. }
  39. return view('auth.passwords.email');
  40. }
  41. /**
  42. * Validate the email for the given request.
  43. *
  44. * @param \Illuminate\Http\Request $request
  45. * @return void
  46. */
  47. protected function validateEmail(Request $request)
  48. {
  49. if(config('pixelfed.bouncer.cloud_ips.ban_logins')) {
  50. abort_if(BouncerService::checkIp($request->ip()), 404);
  51. }
  52. $request->validate(['email' => 'required|email']);
  53. }
  54. }