Completed
Push — master ( dfe268...3e25db )
by Brian
15s queued 12s
created

ConfirmablePasswordController   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

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