LockAccount::handle()   A
last analyzed

Complexity

Conditions 6
Paths 5

Size

Total Lines 17
Code Lines 11

Duplication

Lines 0
Ratio 0 %

Importance

Changes 3
Bugs 0 Features 0
Metric Value
cc 6
eloc 11
c 3
b 0
f 0
nc 5
nop 2
dl 0
loc 17
rs 9.2222
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