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.

UserController   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 4

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 0
loc 34
rs 10
c 1
b 0
f 0
wmc 4
lcom 0
cbo 4

1 Method

Rating   Name   Duplication   Size   Complexity  
B password() 0 24 3
1
<?php
2
3
namespace App\Http\Controllers\Auth;
4
5
use App\Http\Controllers\Controller;
6
use Auth;
7
use Hash;
8
use Illuminate\Http\Request;
9
use Validator;
10
11
class UserController extends Controller
12
{
13
    public function show()
14
    {
15
        $user = Auth::user();
16
17
        return view('user.show', compact('user'));
18
    }
19
20
    public function password(Request $request)
21
    {
22
        $validator = Validator::make($request->all(), [
23
            'current_password'    => 'required',
24
            'new_password'        => 'required',
25
            'new_repeat_password' => 'required|same:new_password',
26
        ]);
27
28
        $user = Auth::user();
29
        $currentPassword = $user->password;
30
31
        $ensureCurrentPassword = $request->input('current_password');
32
        if ($validator->passes() && Hash::check($ensureCurrentPassword, $currentPassword)) {
33
            $user->password = Hash::make($request->input('new_password'));
34
            $user->save();
35
            session(['status' => __('mmex.updated')]);
36
37
            return view('user.show', compact('user'));
38
        } else {
39
            $validator->errors()->add('current_password', __('mmex.current-password-wrong'));
40
41
            return redirect()->back()->withErrors($validator);
42
        }
43
    }
44
}
45