PasswordResetLinkController   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 10
dl 0
loc 32
ccs 13
cts 13
cp 1
rs 10
c 0
b 0
f 0
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A store() 0 17 2
A create() 0 3 1
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\Password;
9
use Illuminate\View\View;
10
11
class PasswordResetLinkController extends Controller
12
{
13
    /**
14
     * Display the password reset link request view.
15
     */
16 1
    public function create(): View
17
    {
18 1
        return view('seller.auth.forgot-password');
19
    }
20
21
    /**
22
     * Handle an incoming password reset link request.
23
     *
24
     * @throws \Illuminate\Validation\ValidationException
25
     */
26 3
    public function store(Request $request): RedirectResponse
27
    {
28 3
        $request->validate([
29 3
            'email' => ['required', 'email'],
30 3
        ]);
31
32
        // We will send the password reset link to this user. Once we have attempted
33
        // to send the link, we will examine the response then see the message we
34
        // need to show to the user. Finally, we'll send out a proper response.
35 3
        $status = Password::broker('sellers')->sendResetLink(
36 3
            $request->only('email')
37 3
        );
38
39 3
        return $status == Password::RESET_LINK_SENT
40 3
                    ? back()->with('status', __($status))
41 3
                    : back()->withInput($request->only('email'))
42 3
                            ->withErrors(['email' => __($status)]);
43
    }
44
}
45