45 lines
1.1 KiB
PHP
45 lines
1.1 KiB
PHP
|
|
<?php
|
||
|
|
|
||
|
|
declare(strict_types=1);
|
||
|
|
|
||
|
|
namespace App\Http\Controllers\Auth;
|
||
|
|
|
||
|
|
use App\Http\Controllers\Controller;
|
||
|
|
use Illuminate\Http\RedirectResponse;
|
||
|
|
use Illuminate\Http\Request;
|
||
|
|
use Illuminate\Support\Facades\Password;
|
||
|
|
use Inertia\Inertia;
|
||
|
|
use Inertia\Response;
|
||
|
|
|
||
|
|
class PasswordResetLinkController extends Controller
|
||
|
|
{
|
||
|
|
/**
|
||
|
|
* Display the password reset link request view.
|
||
|
|
*/
|
||
|
|
public function create(): Response
|
||
|
|
{
|
||
|
|
return Inertia::render('auth/ForgotPassword', [
|
||
|
|
'status' => session('status'),
|
||
|
|
]);
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Handle an incoming password reset link request.
|
||
|
|
*/
|
||
|
|
public function store(Request $request): RedirectResponse
|
||
|
|
{
|
||
|
|
$request->validate([
|
||
|
|
'email' => ['required', 'email'],
|
||
|
|
]);
|
||
|
|
|
||
|
|
$status = Password::sendResetLink(
|
||
|
|
$request->only('email')
|
||
|
|
);
|
||
|
|
|
||
|
|
return $status == Password::RESET_LINK_SENT
|
||
|
|
? back()->with('status', __($status))
|
||
|
|
: back()->withInput($request->only('email'))
|
||
|
|
->withErrors(['email' => __($status)]);
|
||
|
|
}
|
||
|
|
}
|