@@ -56,8 +56,8 @@ discard block |
||
56 | 56 | $conf = config('irfa.lockout'); |
57 | 57 | |
58 | 58 | $this->line('<fg=default>-------------------------------------------------------------------------------'); |
59 | - $this->line('<fg=yellow>Commands'); |
|
60 | - $table = new Table($this->output); |
|
59 | + $this->line('<fg=yellow>Commands'); |
|
60 | + $table = new Table($this->output); |
|
61 | 61 | $table->setRows([ |
62 | 62 | ['<fg=cyan>php artisan lockout:lock {username}','<fg=default>locking account'], |
63 | 63 | ['<fg=cyan>php artisan lockout:unlock {username}','<fg=default>unlocking account'], |
@@ -65,8 +65,8 @@ discard block |
||
65 | 65 | ['<fg=cyan>php artisan lockout:is-locked {username}','<fg=default>checking account (return boolean)'], |
66 | 66 | ['<fg=cyan>php artisan lockout:clear','<fg=default>unlocking all account']] |
67 | 67 | ); |
68 | - $table->render(); |
|
69 | - $this->line('<fg=default>-------------------------------------------------------------------------------'); |
|
68 | + $table->render(); |
|
69 | + $this->line('<fg=default>-------------------------------------------------------------------------------'); |
|
70 | 70 | $this->line('<fg=yellow>Configuration'); |
71 | 71 | foreach($conf as $key => $val){ |
72 | 72 | if(is_array($val)){ |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | $row[] = ['<fg=default>'.$key,' <fg=cyan>'.$vl]; |
80 | 80 | } |
81 | 81 | // dd($row); |
82 | - $table = new Table($this->output); |
|
82 | + $table = new Table($this->output); |
|
83 | 83 | $table->setRows($row); |
84 | 84 | $table->render(); |
85 | 85 | } |
@@ -45,13 +45,13 @@ |
||
45 | 45 | if($lock){ |
46 | 46 | $table->setRows([ |
47 | 47 | ['<fg=yellow>'.$username.' is locked',]]); |
48 | - $table->render(); |
|
48 | + $table->render(); |
|
49 | 49 | $this->line('<fg=default>Run <fg=cyan>php artisan lockout:unlock '.$username.'<fg=default> to unlock account.'); |
50 | 50 | } else{ |
51 | - $table->setRows([ |
|
51 | + $table->setRows([ |
|
52 | 52 | ['<fg=green>'.$username.' is unlocked',]]); |
53 | - $table->render(); |
|
54 | - $this->line('<fg=default>Run <fg=cyan>php artisan lockout:lock '.$username.'<fg=default> to lock account.'); |
|
53 | + $table->render(); |
|
54 | + $this->line('<fg=default>Run <fg=cyan>php artisan lockout:lock '.$username.'<fg=default> to lock account.'); |
|
55 | 55 | } |
56 | 56 | |
57 | 57 | // $this->line('<fg=yellow>Valid input is lock, unlock, and attemps.'); |
@@ -16,9 +16,9 @@ |
||
16 | 16 | } |
17 | 17 | return true; |
18 | 18 | } |
19 | - public function isLocked($username){ |
|
20 | - return $this->is_locked($username); |
|
21 | - } |
|
19 | + public function isLocked($username){ |
|
20 | + return $this->is_locked($username); |
|
21 | + } |
|
22 | 22 | public function message(){ |
23 | 23 | return $this->showMessage(); |
24 | 24 | } |
@@ -21,7 +21,7 @@ |
||
21 | 21 | public function handle($request, Closure $next) |
22 | 22 | { |
23 | 23 | if($this->exceptAccount()){ |
24 | - return $next($request); |
|
24 | + return $next($request); |
|
25 | 25 | } |
26 | 26 | |
27 | 27 | if ($request->method() == "POST") { |
@@ -23,7 +23,7 @@ |
||
23 | 23 | public function handle($request, Closure $next) |
24 | 24 | { |
25 | 25 | if($this->exceptAccount()){ |
26 | - return $next($request); |
|
26 | + return $next($request); |
|
27 | 27 | } else{ |
28 | 28 | if ($request->method() == "POST") { |
29 | 29 | if (in_array($request->path(), config('irfa.lockout.protected_action_path'))) { |
@@ -5,35 +5,35 @@ |
||
5 | 5 | |
6 | 6 | class Variable { |
7 | 7 | |
8 | - protected $ip; |
|
9 | - protected $input=null; |
|
10 | - protected $dir; |
|
11 | - protected $path; |
|
12 | - protected $attemps; |
|
13 | - protected $except_enabled; |
|
14 | - protected $except_accounts; |
|
15 | - protected $permission_code; |
|
8 | + protected $ip; |
|
9 | + protected $input=null; |
|
10 | + protected $dir; |
|
11 | + protected $path; |
|
12 | + protected $attemps; |
|
13 | + protected $except_enabled; |
|
14 | + protected $except_accounts; |
|
15 | + protected $permission_code; |
|
16 | 16 | |
17 | - /** |
|
18 | - * Initializing variable. |
|
19 | - * |
|
20 | - * @return void |
|
21 | - */ |
|
22 | - protected function initVar(){ |
|
23 | - // if(!empty(config('irfa.lockout'))){ |
|
24 | - $this->ip = Request::ip(); |
|
25 | - $this->input = Request::input(config('irfa.lockout.input_name')); |
|
26 | - $this->dir = config('irfa.lockout.lockout_file_path'); |
|
27 | - $this->attemps = config('irfa.lockout.login_attemps'); |
|
28 | - $this->except_enabled = config('irfa.lockout.enable_except_account'); |
|
29 | - $this->except_accounts = config('irfa.lockout.except_account'); |
|
30 | - $this->path = $this->dir.md5($this->input); |
|
31 | - // } |
|
32 | - } |
|
17 | + /** |
|
18 | + * Initializing variable. |
|
19 | + * |
|
20 | + * @return void |
|
21 | + */ |
|
22 | + protected function initVar(){ |
|
23 | + // if(!empty(config('irfa.lockout'))){ |
|
24 | + $this->ip = Request::ip(); |
|
25 | + $this->input = Request::input(config('irfa.lockout.input_name')); |
|
26 | + $this->dir = config('irfa.lockout.lockout_file_path'); |
|
27 | + $this->attemps = config('irfa.lockout.login_attemps'); |
|
28 | + $this->except_enabled = config('irfa.lockout.enable_except_account'); |
|
29 | + $this->except_accounts = config('irfa.lockout.except_account'); |
|
30 | + $this->path = $this->dir.md5($this->input); |
|
31 | + // } |
|
32 | + } |
|
33 | 33 | |
34 | - protected function setPath($username){ |
|
35 | - $this->path = $this->dir.md5($username); |
|
36 | - $this->input = $username; |
|
37 | - } |
|
34 | + protected function setPath($username){ |
|
35 | + $this->path = $this->dir.md5($username); |
|
36 | + $this->input = $username; |
|
37 | + } |
|
38 | 38 | |
39 | - } |
|
40 | 39 | \ No newline at end of file |
40 | + } |
|
41 | 41 | \ No newline at end of file |
@@ -17,13 +17,13 @@ discard block |
||
17 | 17 | protected function exceptAccount(){ |
18 | 18 | $this->initVar(); |
19 | 19 | if($this->except_enabled){ |
20 | - if(in_array($this->input, $this->except_accounts)){ |
|
20 | + if(in_array($this->input, $this->except_accounts)){ |
|
21 | 21 | return true; |
22 | - } else{ |
|
22 | + } else{ |
|
23 | 23 | return false; |
24 | - } |
|
24 | + } |
|
25 | 25 | } else{ |
26 | - return false; |
|
26 | + return false; |
|
27 | 27 | } |
28 | 28 | } |
29 | 29 | |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | * @return void |
75 | 75 | */ |
76 | 76 | protected function eventCleanLockoutAccount() { |
77 | - $this->initVar(); |
|
77 | + $this->initVar(); |
|
78 | 78 | $this->unlock_account($this->input); |
79 | 79 | |
80 | 80 | } |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | * @return boolean |
134 | 134 | */ |
135 | 135 | protected function lockLogin($username = null){ |
136 | - $this->initVar(); |
|
136 | + $this->initVar(); |
|
137 | 137 | if(php_sapi_name() == "cli" AND $username != null){ |
138 | 138 | $this->setPath($username); |
139 | 139 | } |
@@ -161,7 +161,7 @@ discard block |
||
161 | 161 | * @return boolean |
162 | 162 | */ |
163 | 163 | private function checkIp($ip_list,$ip){ |
164 | - $this->initVar(); |
|
164 | + $this->initVar(); |
|
165 | 165 | if(collect($ip_list)->contains($ip)){ |
166 | 166 | return true; |
167 | 167 | } else{ |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | * @return boolean |
177 | 177 | */ |
178 | 178 | public function clear_all(){ |
179 | - $this->initVar(); |
|
179 | + $this->initVar(); |
|
180 | 180 | $file = new Filesystem(); |
181 | 181 | if($file->cleanDirectory($this->path)){ |
182 | 182 | return true; |
@@ -31,7 +31,7 @@ |
||
31 | 31 | $this->logging(); |
32 | 32 | if(!$this->exceptAccount()){ |
33 | 33 | |
34 | - $this->eventFailedLogin(); |
|
34 | + $this->eventFailedLogin(); |
|
35 | 35 | |
36 | 36 | } |
37 | 37 |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | |
12 | 12 | public function testConfig(){ |
13 | 13 | $this->ret=[]; |
14 | - $this->ret['err'] = 0; |
|
14 | + $this->ret['err'] = 0; |
|
15 | 15 | |
16 | 16 | |
17 | 17 | if(!empty(config('irfa.lockout'))){ |
@@ -33,30 +33,30 @@ discard block |
||
33 | 33 | |
34 | 34 | return $this->ret; |
35 | 35 | } |
36 | - public function testWriteEventFailedLogin($username){ |
|
36 | + public function testWriteEventFailedLogin($username){ |
|
37 | 37 | |
38 | - $this->eventFailedLogin($username); |
|
38 | + $this->eventFailedLogin($username); |
|
39 | 39 | |
40 | - $input = $username; |
|
41 | - $dir = config('irfa.lockout.lockout_file_path'); |
|
42 | - $path = $dir.md5($input); |
|
40 | + $input = $username; |
|
41 | + $dir = config('irfa.lockout.lockout_file_path'); |
|
42 | + $path = $dir.md5($input); |
|
43 | 43 | |
44 | - if(File::exists($path)) |
|
44 | + if(File::exists($path)) |
|
45 | 45 | { |
46 | - return true; |
|
46 | + return true; |
|
47 | 47 | } |
48 | - return false; |
|
48 | + return false; |
|
49 | 49 | } |
50 | 50 | public function testWritable($username){ |
51 | - $input = $username; |
|
52 | - $dir = config('irfa.lockout.lockout_file_path'); |
|
53 | - $path = $dir.md5($input); |
|
51 | + $input = $username; |
|
52 | + $dir = config('irfa.lockout.lockout_file_path'); |
|
53 | + $path = $dir.md5($input); |
|
54 | 54 | |
55 | - if(is_writable($path)) |
|
55 | + if(is_writable($path)) |
|
56 | 56 | { |
57 | - return true; |
|
57 | + return true; |
|
58 | 58 | } |
59 | - return false; |
|
59 | + return false; |
|
60 | 60 | } |
61 | 61 | |
62 | 62 | public function testManualLocking($username){ |
@@ -104,8 +104,8 @@ discard block |
||
104 | 104 | } |
105 | 105 | |
106 | 106 | private function confLogging(){ |
107 | - if(is_bool(config('irfa.lockout.logging'))){ |
|
108 | - $this->ret['logging'] = '<fg=green>OK'; |
|
107 | + if(is_bool(config('irfa.lockout.logging'))){ |
|
108 | + $this->ret['logging'] = '<fg=green>OK'; |
|
109 | 109 | } else{ |
110 | 110 | |
111 | 111 | $this->ret['err'] +=1; |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | $this->ret['input_name'] = '<fg=red>Must be a String'; |
123 | 123 | } |
124 | 124 | } |
125 | - private function confFilePath(){ |
|
125 | + private function confFilePath(){ |
|
126 | 126 | |
127 | 127 | |
128 | 128 | if(is_writable(config('irfa.lockout.lockout_file_path'))){ |
@@ -143,11 +143,11 @@ discard block |
||
143 | 143 | private function confProtectActionPath(){ |
144 | 144 | if(is_array(config('irfa.lockout.protected_action_path'))){ |
145 | 145 | $this->ret['protected_action_path'] = '<fg=green>OK'; |
146 | - if(!empty(config('irfa.lockout.protected_action_path'))){ |
|
146 | + if(!empty(config('irfa.lockout.protected_action_path'))){ |
|
147 | 147 | $this->ret['protected_action_path'] = '<fg=green>OK'; |
148 | 148 | } else{ |
149 | - $this->ret['err'] +=1; |
|
150 | - $this->ret['protected_action_path'] = '<fg=red>Must be provided'; |
|
149 | + $this->ret['err'] +=1; |
|
150 | + $this->ret['protected_action_path'] = '<fg=red>Must be provided'; |
|
151 | 151 | } |
152 | 152 | } else{ |
153 | 153 | |
@@ -161,8 +161,8 @@ discard block |
||
161 | 161 | if(!empty(config('irfa.lockout.protected_middleware_group'))){ |
162 | 162 | $this->ret['protected_middleware_group'] = '<fg=green>OK'; |
163 | 163 | } else{ |
164 | - $this->ret['err'] +=1; |
|
165 | - $this->ret['protected_middleware_group'] = '<fg=red>Must be provided'; |
|
164 | + $this->ret['err'] +=1; |
|
165 | + $this->ret['protected_middleware_group'] = '<fg=red>Must be provided'; |
|
166 | 166 | } |
167 | 167 | } else{ |
168 | 168 | |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | |
173 | 173 | } |
174 | 174 | private function confMessage(){ |
175 | - if(is_string(config('irfa.lockout.message_name'))){ |
|
175 | + if(is_string(config('irfa.lockout.message_name'))){ |
|
176 | 176 | $this->ret['message_name'] = '<fg=green>OK'; |
177 | 177 | } else{ |
178 | 178 | |
@@ -181,8 +181,8 @@ discard block |
||
181 | 181 | } |
182 | 182 | |
183 | 183 | } |
184 | - private function confExceptEnabled(){ |
|
185 | - if(is_bool(config('irfa.lockout.enable_except_account'))){ |
|
184 | + private function confExceptEnabled(){ |
|
185 | + if(is_bool(config('irfa.lockout.enable_except_account'))){ |
|
186 | 186 | $this->ret['enable_except_account'] = '<fg=green>OK'; |
187 | 187 | } else{ |
188 | 188 | |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | |
193 | 193 | } |
194 | 194 | private function confExceptAccount(){ |
195 | - if(is_array(config('irfa.lockout.except_account'))){ |
|
195 | + if(is_array(config('irfa.lockout.except_account'))){ |
|
196 | 196 | if(!empty(config('irfa.lockout.except_account'))){ |
197 | 197 | $this->ret['except_account'] = '<fg=green>OK'; |
198 | 198 | } else{ |