ForgotPasswordController.php 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <?php
  2. namespace App\Http\Controllers\Auth;
  3. use App\Http\Controllers\Controller;
  4. use App\Settings\GeneralSettings;
  5. use Illuminate\Foundation\Auth\SendsPasswordResetEmails;
  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. protected function validateEmail(Request $request, GeneralSettings $general_settings)
  30. {
  31. $this->validate($request, [
  32. 'email' => ['required', 'string', 'email', 'max:255'],
  33. ]);
  34. if ($general_settings->recaptcha_enabled) {
  35. $this->validate($request, [
  36. 'g-recaptcha-response' => 'required|recaptcha',
  37. ]);
  38. }
  39. }
  40. }