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.

RemindersController   A
last analyzed

Complexity

Total Complexity 16

Size/Duplication

Total Lines 126
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 4

Importance

Changes 0
Metric Value
wmc 16
lcom 0
cbo 4
dl 0
loc 126
rs 10
c 0
b 0
f 0

6 Methods

Rating   Name   Duplication   Size   Complexity  
A getRemind() 0 12 2
A postRemind() 0 18 3
A getReset() 0 4 1
A postReset() 0 24 5
A getChangePassword() 0 9 2
A postChangePassword() 0 25 3
1
<?php
2
namespace Serverfireteam\Panel;
3
4
use Illuminate\Contracts\Auth\PasswordBroker as PasswordBrokerContract;
5
use Illuminate\Routing\Controller;
6
use Illuminate\Support\Facades\Input;
7
8
/*******
9
 * The RemindersControler handle the users Password reminding activities
10
 * 
11
 *******/
12
class RemindersController extends Controller {
13
14
    
15
    /**
16
     * Display the password reminder view.
17
     *
18
     * @return Response
19
     */
20
    public function getRemind()
21
    {
22
        if (\Session::has('message')) {
23
            $message = \Session::get('message');
24
        } else {
25
            $message = \Lang::get('panel::fields.enterEmail');
26
        }
27
28
        return \View::make('panelViews::passwordReminder')
29
                ->with('message', $message)
30
                ->with('mesType', \Session::get('mesType'));
31
    }
32
33
	/**
34
	 * Handle a POST request to remind a user of their password.
35
	 *
36
	 * @return Response
37
	 */
38
	public function postRemind()
39
	{
40
        \App::make('route');
41
42
        \Config::set('auth.defaults.passwords', 'panel');
43
44
	    $response = \Password::sendResetLink(Input::only('email'), function($message) {
45
		  $message->subject('Password Reminder');
46
	    });
47
48
        switch ($response) {
49
                case PasswordBrokerContract::INVALID_USER:
50
                        return \Redirect::back()->with('message', \Lang::get($response))->with('mesType', 'error');
51
52
                case PasswordBrokerContract::RESET_LINK_SENT:
53
                        return \Redirect::back()->with('message', \Lang::get($response))->with('mesType', 'info');
54
        }
55
	}
56
57
	/**
58
	 * Display the password reset view for the given token.
59
	 *
60
	 * @param  string  $token
61
	 * @return Response
62
	 */
63
	public function getReset($token = null)
0 ignored issues
show
Unused Code introduced by
The parameter $token is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
64
	{
65
        	return \View::make('panelViews::passwordReset');
66
	}
67
68
    public function postReset()
69
    {
70
71
        $credentials = Input::only(
72
            'email', 'password', 'password_confirmation', 'token'
0 ignored issues
show
Unused Code introduced by
The call to Input::only() has too many arguments starting with 'password'.

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.

In this case you can add the @ignore PhpDoc annotation to the duplicate definition and it will be ignored.

Loading history...
73
        );
74
        \Config::set('auth.defaults.passwords', 'panel');
75
76
        $response = \Password::reset($credentials, function($user, $password) {
77
            $user->password = \Hash::make($password);
78
            $user->save();
79
        });
80
81
        switch ($response) {
82
        case PasswordBrokerContract::INVALID_PASSWORD:
83
                    return \Redirect::back()->with('message', \Lang::get($response))->with('mesType','error');
84
            case PasswordBrokerContract::INVALID_TOKEN:
85
                    return \Redirect::back()->with('message', \Lang::get($response))->with('mesType','error');
86
                case PasswordBrokerContract::INVALID_USER:
87
                    return \Redirect::back()->with('message', \Lang::get($response))->with('mesType','error');
88
            case PasswordBrokerContract::PASSWORD_RESET:
89
                    return \Redirect::to('/panel')->with('message', \Lang::get('panel::fields.successfullReset'))->with('mesType','info');
90
        }
91
	}
92
93
    /********
94
     * The function displays the password
95
     * change view
96
     ********/
97
	public function getChangePassword() {
98
99
        $demo = false;
100
        if (\Config::get('panel.demo') == true) {
101
            $demo = true;
102
        }
103
104
        return \View::make('panelViews::passwordChange')->with('demo_status', $demo);
105
	}
106
107
     /********
108
     * After User enter the new password 
109
     * this function handles the resetting the
110
     * the password
111
     ********/
112
	public function postChangePassword() {
113
114
        $user 		 = Admin::find(\Auth::guard('panel')->user()->id);
115
        $password 	 = Input::only('current_password');
116
        $new_password    = Input::only('password');
117
        $retype_password = Input::only('password_confirmation');
118
        $user_password   = \Auth::guard('panel')->user()->password;
119
120
        //Check to see if user enters current password correctly
121
        if (\Hash::check($password['current_password'], $user_password)) {
122
            if ($new_password['password'] == $retype_password['password_confirmation']) {
123
                    $user->password = \Hash::make($new_password['password']);
124
                    $user->save();
125
                    return \Redirect::to('/panel/changePassword')->with('message', 'Successfully Changed Your Password!!');
126
            } else {
127
                    return \Redirect::to('/panel/changePassword')
128
                                    ->with('message', 'Passwords not matched!!')
129
                                    ->with('mesType', 'error');
130
            }
131
        } else {
132
            return \Redirect::to('/panel/changePassword')
133
                                 ->with('message', 'Password is not correct!!')
134
                                 ->with('mesType', 'error');
135
        }
136
	}
137
}
138