ConfirmablePasswordController   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 9
c 1
b 0
f 0
dl 0
loc 27
ccs 12
cts 12
cp 1
rs 10
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A show() 0 3 1
A store() 0 14 2
1
<?php
2
3
namespace App\Http\Controllers\Auth;
4
5
use App\Http\Controllers\Controller;
6
use App\Providers\RouteServiceProvider;
7
use Illuminate\Http\RedirectResponse;
8
use Illuminate\Http\Request;
9
use Illuminate\Support\Facades\Auth;
10
use Illuminate\Validation\ValidationException;
11
use Illuminate\View\View;
12
13
class ConfirmablePasswordController extends Controller
14
{
15
    /**
16
     * Show the confirm password view.
17
     */
18 1
    public function show(): View
19
    {
20 1
        return view('auth.confirm-password');
21
    }
22
23
    /**
24
     * Confirm the user's password.
25
     */
26 2
    public function store(Request $request): RedirectResponse
27
    {
28 2
        if (! Auth::guard('web')->validate([
29 2
            'email' => $request->user()->email,
30 2
            'password' => $request->password,
31 2
        ])) {
32 1
            throw ValidationException::withMessages([
33 1
                'password' => __('auth.password'),
34 1
            ]);
35
        }
36
37 1
        $request->session()->put('auth.password_confirmed_at', time());
38
39 1
        return redirect()->intended(RouteServiceProvider::HOME);
40
    }
41
}
42