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.
Completed
Push — master ( 7d30e4...b723a0 )
by Andrea
03:14
created

ForgotPasswordController   A

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
6
use Illuminate\Foundation\Auth\SendsPasswordResetEmails;
7
use Illuminate\Http\Request;
8
use Illuminate\Support\Facades\Password;
9
use Prologue\Alerts\Facades\Alert;
10
11
class ForgotPasswordController extends Controller
12
{
13
    protected $data = []; // the information we send to the view
14
15
    use SendsPasswordResetEmails;
16
    /**
17
     * Create a new controller instance.
18
     *
19
     * @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...
20
     */
21
    public function __construct()
22
    {
23
        $this->middleware('guest');
24
    }
25
26
    /**
27
     * Display the form to request a password reset link.
28
     *
29
     * @return \Illuminate\Http\Response
30
     */
31
    public function showLinkRequestForm()
32
    {
33
        $this->data['title'] = trans('back-project::base.reset_password'); // set the page title
34
        return view('back-project::auth.passwords.email', $this->data);
35
    }
36
37
    public function sendResetLinkEmail(Request $request)
38
    {
39
        $this->validate($request, ['email' => 'required|email']);
40
41
        // We will send the password reset link to this user. Once we have attempted
42
        // to send the link, we will examine the response then see the message we
43
        // need to show to the user. Finally, we'll send out a proper response.
44
        $response = $this->broker()->sendResetLink(
45
            $request->only('email')
46
        );
47
48
        if ($response == Password::RESET_LINK_SENT) {
49
            Alert::add('success', trans('back-project::base.reset_password_email_sent'))->flash();
50
        }
51
52
        return $response == Password::RESET_LINK_SENT
53
            ? $this->sendResetLinkResponse($response)
54
            : $this->sendResetLinkFailedResponse($request, $response);
55
    }
56
}
57