diff options
| author | grothedev <grothedev@gmail.com> | 2025-01-07 17:17:18 -0600 |
|---|---|---|
| committer | grothedev <grothedev@gmail.com> | 2025-01-07 17:17:18 -0600 |
| commit | b80906c8d6d54d47897d9a7c58e02c76d0c06e60 (patch) | |
| tree | 2187364dc42b3ca89cb74869aade4f8199570d5e /app/Http/Controllers/Auth/ConfirmablePasswordController.php | |
| parent | 8aa5d1ff626c55a01916035c85af9b2b9486834f (diff) | |
adding auth stuff, session idea, other random stuff
Diffstat (limited to 'app/Http/Controllers/Auth/ConfirmablePasswordController.php')
| -rw-r--r-- | app/Http/Controllers/Auth/ConfirmablePasswordController.php | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/app/Http/Controllers/Auth/ConfirmablePasswordController.php b/app/Http/Controllers/Auth/ConfirmablePasswordController.php new file mode 100644 index 0000000..712394a --- /dev/null +++ b/app/Http/Controllers/Auth/ConfirmablePasswordController.php @@ -0,0 +1,40 @@ +<?php + +namespace App\Http\Controllers\Auth; + +use App\Http\Controllers\Controller; +use Illuminate\Http\RedirectResponse; +use Illuminate\Http\Request; +use Illuminate\Support\Facades\Auth; +use Illuminate\Validation\ValidationException; +use Illuminate\View\View; + +class ConfirmablePasswordController extends Controller +{ + /** + * Show the confirm password view. + */ + public function show(): View + { + return view('auth.confirm-password'); + } + + /** + * Confirm the user's password. + */ + public function store(Request $request): RedirectResponse + { + if (! Auth::guard('web')->validate([ + 'email' => $request->user()->email, + 'password' => $request->password, + ])) { + throw ValidationException::withMessages([ + 'password' => __('auth.password'), + ]); + } + + $request->session()->put('auth.password_confirmed_at', time()); + + return redirect()->intended(route('dashboard', absolute: false)); + } +} |
