Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
10 / 10
100.00% covered (success)
100.00%
2 / 2
CRAP
100.00% covered (success)
100.00%
1 / 1
ConfirmablePasswordController
100.00% covered (success)
100.00%
10 / 10
100.00% covered (success)
100.00%
2 / 2
3
100.00% covered (success)
100.00%
1 / 1
 show
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 store
100.00% covered (success)
100.00%
9 / 9
100.00% covered (success)
100.00%
1 / 1
2
1<?php
2
3namespace App\Http\Controllers\Auth;
4
5use App\Http\Controllers\Controller;
6use Illuminate\Http\RedirectResponse;
7use Illuminate\Http\Request;
8use Illuminate\Support\Facades\Auth;
9use Illuminate\Validation\ValidationException;
10use Inertia\Inertia;
11use Inertia\Response;
12
13class ConfirmablePasswordController extends Controller
14{
15    /**
16     * Show the confirm password view.
17     */
18    public function show(): Response
19    {
20        return Inertia::render('Auth/ConfirmPassword');
21    }
22
23    /**
24     * Confirm the user's password.
25     */
26    public function store(Request $request): RedirectResponse
27    {
28        if (! Auth::guard('web')->validate([
29            'email' => $request->user()->email,
30            'password' => $request->password,
31        ])) {
32            throw ValidationException::withMessages([
33                'password' => __('auth.password'),
34            ]);
35        }
36
37        $request->session()->put('auth.password_confirmed_at', time());
38
39        return redirect()->intended(route('dashboard', absolute: false));
40    }
41}