LockAccount   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Importance

Changes 3
Bugs 0 Features 0
Metric Value
eloc 12
c 3
b 0
f 0
dl 0
loc 26
rs 10
wmc 6

1 Method

Rating   Name   Duplication   Size   Complexity  
A handle() 0 17 6
1
<?php
2
3
namespace Irfa\Lockout\Middleware;
4
5
use Closure;
6
use Auth;
7
use Session;
8
use Route;
9
use URL;
10
use Lang;
11
use Illuminate\Support\Facades\File;
12
use Irfa\Lockout\Func\Core;
13
14
class LockAccount extends Core
15
{
16
    /**
17
     * Handle an incoming request.
18
     *
19
     * @param  \Illuminate\Http\Request  $request
20
     * @param  \Closure  $next
21
     * @return mixed
22
     */
23
    public function handle($request, Closure $next)
24
    {
25
        if($this->exceptAccount()){
26
             return $next($request);
27
        } else{
28
        if ($request->method() == "POST") {
29
            if (in_array($request->path(), config('irfa.lockout.protected_action_path'))) {
30
                if ($this->lockLogin()) {
31
                    $this->eventFailedLogin();
32
                    $this->logging();
33
                    Session::flash(config('irfa.lockout.message_name'), Lang::get('lockoutMessage.locked'));
34
                    return redirect(empty(config('irfa.lockout.redirect_url')) ? "/" : URL::to(config('irfa.lockout.redirect_url')));
35
                }
36
            }
37
        }
38
        }
39
            return $next($request);
40
    }
41
}
42