From fe5821fe7562503330ae63962cd0edf379ca52e3 Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Fri, 11 Sep 2020 16:42:25 -0500 Subject: [PATCH] confirmed password status controller --- routes/routes.php | 4 ++++ .../ConfirmablePasswordController.php | 2 +- .../ConfirmedPasswordStatusController.php | 22 +++++++++++++++++++ 3 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 src/Http/Controllers/ConfirmedPasswordStatusController.php diff --git a/routes/routes.php b/routes/routes.php index 89786698..b5e8dcab 100644 --- a/routes/routes.php +++ b/routes/routes.php @@ -91,6 +91,10 @@ Route::post('/user/confirm-password', 'ConfirmablePasswordController@store') ->middleware(['auth']); + Route::get('/user/confirmed-password-status', 'ConfirmedPasswordStatusController@show') + ->middleware(['auth']) + ->name('password.confirmation'); + // Two Factor Authentication... if (Features::enabled(Features::twoFactorAuthentication())) { Route::post('/user/two-factor-authentication', 'TwoFactorAuthenticationController@store') diff --git a/src/Http/Controllers/ConfirmablePasswordController.php b/src/Http/Controllers/ConfirmablePasswordController.php index 22b364f2..d61d2797 100644 --- a/src/Http/Controllers/ConfirmablePasswordController.php +++ b/src/Http/Controllers/ConfirmablePasswordController.php @@ -34,7 +34,7 @@ public function __construct(StatefulGuard $guard) * Show the confirm password view. * * @param \Illuminate\Http\Request $request - * @return \Laravel\Fortify\Contracts\VerifyPasswordViewResponse + * @return \Laravel\Fortify\Contracts\ConfirmPasswordViewResponse */ public function show(Request $request) { diff --git a/src/Http/Controllers/ConfirmedPasswordStatusController.php b/src/Http/Controllers/ConfirmedPasswordStatusController.php new file mode 100644 index 00000000..5c7e7e0f --- /dev/null +++ b/src/Http/Controllers/ConfirmedPasswordStatusController.php @@ -0,0 +1,22 @@ +json([ + 'confirmed' => (time() - $request->session()->get('auth.password_confirmed_at', 0)) < $request->input('seconds', 900), + ]); + } +}