Conditions | 6 |
Paths | 4 |
Total Lines | 18 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Tests | 6 |
CRAP Score | 7.3329 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
20 | 560 | public function handle($request, Closure $next) |
|
21 | { |
||
22 | 560 | if(Auth::check() && !(Route::current()->getName() === 'changePassword' || Route::current()->getName() === 'logout')) |
|
23 | { |
||
24 | // Verify that the users password has not expired |
||
25 | 502 | if(Auth::user()->password_expires !== null) |
|
26 | { |
||
27 | 502 | $passExp = new Carbon((Auth::user()->password_expires)); |
|
28 | if(Carbon::now() > $passExp ) |
||
29 | 502 | { |
|
30 | Log::notice('User ID-'.Auth::user()->user_id.' is being forced to change their password.'); |
||
31 | $request->session()->flash('change_password', 'change_password'); |
||
32 | return redirect()->route('changePassword'); |
||
33 | } |
||
34 | } |
||
35 | } |
||
36 | 502 | ||
37 | return $next($request); |
||
38 | } |
||
40 |