GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

ForgotPasswordController   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 46
Duplicated Lines 0 %

Coupling/Cohesion

Components 2
Dependencies 4

Importance

Changes 0
Metric Value
dl 0
loc 46
rs 10
c 0
b 0
f 0
wmc 5
lcom 2
cbo 4

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A showLinkRequestForm() 0 5 1
A sendResetLinkEmail() 0 19 3
1
<?php
2
namespace Afrittella\BackProject\Http\Controllers\Auth;
3
4
use Afrittella\BackProject\Http\Controllers\Controller;
5
use Illuminate\Foundation\Auth\SendsPasswordResetEmails;
6
use Illuminate\Http\Request;
7
use Illuminate\Support\Facades\Password;
8
use Prologue\Alerts\Facades\Alert;
9
10
class ForgotPasswordController extends Controller
11
{
12
    protected $data = []; // the information we send to the view
13
14
    use SendsPasswordResetEmails;
15
    /**
16
     * Create a new controller instance.
17
     *
18
     * @return void
0 ignored issues
show
Comprehensibility Best Practice introduced by
Adding a @return annotation to constructors is generally not recommended as a constructor does not have a meaningful return value.

Adding a @return annotation to a constructor is not recommended, since a constructor does not have a meaningful return value.

Please refer to the PHP core documentation on constructors.

Loading history...
19
     */
20
    public function __construct()
21
    {
22
        $this->middleware('guest');
23
    }
24
25
    /**
26
     * Display the form to request a password reset link.
27
     *
28
     * @return \Illuminate\Http\Response
29
     */
30
    public function showLinkRequestForm()
31
    {
32
        $this->data['title'] = trans('back-project::base.reset_password'); // set the page title
33
        return view('back-project::auth.passwords.email', $this->data);
34
    }
35
36
    public function sendResetLinkEmail(Request $request)
37
    {
38
        $this->validate($request, ['email' => 'required|email']);
39
40
        // We will send the password reset link to this user. Once we have attempted
41
        // to send the link, we will examine the response then see the message we
42
        // need to show to the user. Finally, we'll send out a proper response.
43
        $response = $this->broker()->sendResetLink(
44
            $request->only('email')
45
        );
46
47
        if ($response == Password::RESET_LINK_SENT) {
48
            Alert::add('success', trans('back-project::base.reset_password_email_sent'))->flash();
49
        }
50
51
        return $response == Password::RESET_LINK_SENT
52
            ? $this->sendResetLinkResponse($response)
53
            : $this->sendResetLinkFailedResponse($request, $response);
54
    }
55
}
56