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

ConfirmablePasswordController::show()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
c 0
b 0
f 0
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