Passed
Pull Request — master (#89)
by
unknown
40:26
created

ForgotPasswordController::__construct()   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 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
1
<?php
2
3
namespace App\Http\Controllers\Auth;
4
5
use Illuminate\Http\Request;
6
use Illuminate\Support\Facades\Log;
7
use App\Http\Controllers\Controller;
8
use Illuminate\Support\Facades\Password;
9
use Illuminate\Foundation\Auth\SendsPasswordResetEmails;
10
11
class ForgotPasswordController extends Controller
12
{
13
    use SendsPasswordResetEmails;
14
15 10
    public function __construct()
16
    {
17 10
        $this->middleware('guest');
18 10
    }
19
20
    //  Override the sendResetLinkEmail function to provide logging when a reset request is made
21 6
    public function sendResetLinkEmail(Request $request)
22
    {
23 6
        $this->validateEmail($request);
24
25 4
        $response = $this->broker()->sendResetLink(
26 4
            $this->credentials($request)
27
        );
28
29 4
        $passOrFail = $response === 'passwords.sent' ? 'successful' : 'failed';
30 4
        Log::info('A password reset request was made for '.$request->email.'.  Response - '.$passOrFail);
31 4
        return $response == Password::RESET_LINK_SENT
32 2
                    ? $this->sendResetLinkResponse($request, $response)
33 4
                    : $this->sendResetLinkFailedResponse($request, $response);
34
    }
35
}
36