Nenhuma descrição
Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

PasswordResetLinkController.php 1.3KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. <?php
  2. namespace App\Http\Controllers\Auth;
  3. use App\Http\Controllers\Controller;
  4. use Illuminate\Http\RedirectResponse;
  5. use Illuminate\Http\Request;
  6. use Illuminate\Support\Facades\Password;
  7. use Illuminate\View\View;
  8. class PasswordResetLinkController extends Controller
  9. {
  10. /**
  11. * Display the password reset link request view.
  12. */
  13. public function create(): View
  14. {
  15. return view('auth.forgot-password');
  16. }
  17. /**
  18. * Handle an incoming password reset link request.
  19. *
  20. * @throws \Illuminate\Validation\ValidationException
  21. */
  22. public function store(Request $request): RedirectResponse
  23. {
  24. $request->validate([
  25. 'email' => ['required', 'email'],
  26. ]);
  27. // We will send the password reset link to this user. Once we have attempted
  28. // to send the link, we will examine the response then see the message we
  29. // need to show to the user. Finally, we'll send out a proper response.
  30. $status = Password::sendResetLink(
  31. $request->only('email')
  32. );
  33. return $status == Password::RESET_LINK_SENT
  34. ? back()->with('status', __($status))
  35. : back()->withInput($request->only('email'))
  36. ->withErrors(['email' => __($status)]);
  37. }
  38. }