1 | <?php |
||
2 | |||
3 | namespace Irfa\Lockout\Middleware; |
||
4 | |||
5 | use Closure; |
||
6 | use Route; |
||
7 | use URL; |
||
8 | use Lang; |
||
9 | use Illuminate\Support\Facades\File; |
||
10 | use Irfa\Lockout\Func\Core; |
||
11 | |||
12 | class ApiLockAccount extends Core |
||
13 | { |
||
14 | /** |
||
15 | * Handle an incoming request. |
||
16 | * |
||
17 | * @param \Illuminate\Http\Request $request |
||
18 | * @param \Closure $next |
||
19 | * @return mixed |
||
20 | */ |
||
21 | public function handle($request, Closure $next) |
||
22 | { |
||
23 | if($this->exceptAccount()){ |
||
24 | return $next($request); |
||
25 | } |
||
26 | |||
27 | if ($request->method() == "POST") { |
||
28 | if (in_array($request->path(), config('irfa.lockout.protected_action_path'))) { |
||
29 | if ($this->lockLogin()) { |
||
30 | $this->eventFailedLogin(); |
||
31 | $this->logging("API"); |
||
32 | $message['code'] = 403; |
||
0 ignored issues
–
show
Comprehensibility
Best Practice
introduced
by
![]() |
|||
33 | $message[config('irfa.lockout.message_name')] = Lang::get('lockoutMessage.locked'); |
||
34 | return response()->json($message); |
||
35 | } |
||
36 | } |
||
37 | } |
||
38 | return $next($request); |
||
39 | } |
||
40 | } |
||
41 |