ConfirmablePasswordController   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 9
c 1
b 0
f 0
dl 0
loc 32
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\Request;
8
use Illuminate\Support\Facades\Auth;
9
use Illuminate\Validation\ValidationException;
10
11
class ConfirmablePasswordController extends Controller
12
{
13
    /**
14
     * Show the confirm password view.
15
     *
16
     * @return \Illuminate\View\View
17
     */
18
    public function show()
19
    {
20
        return view('auth.confirm-password');
21
    }
22
23
    /**
24
     * Confirm the user's password.
25
     *
26
     * @param  \Illuminate\Http\Request  $request
27
     * @return mixed
28
     */
29
    public function store(Request $request)
30
    {
31
        if (! Auth::guard('web')->validate([
32
            'email' => $request->user()->email,
33
            'password' => $request->password,
34
        ])) {
35
            throw ValidationException::withMessages([
36
                'password' => __('auth.password'),
37
            ]);
38
        }
39
40
        $request->session()->put('auth.password_confirmed_at', time());
41
42
        return redirect()->intended(RouteServiceProvider::HOME);
43
    }
44
}
45