@@ -43,9 +43,9 @@ discard block |
||
43 | 43 | */ |
44 | 44 | public function handle() |
45 | 45 | { |
46 | - $curTime = microtime(true); |
|
46 | + $curTime = microtime(true); |
|
47 | 47 | $domain = 'locktest-'.md5(strtolower(config("app.name"))).'@'.strtolower(config("app.name")).".com"; |
48 | - $this->line('<fg=default>--------------------------------------------'); |
|
48 | + $this->line('<fg=default>--------------------------------------------'); |
|
49 | 49 | $this->testConfigurations(); |
50 | 50 | $this->line('<fg=default>Testing Mail : <fg=cyan>'.$domain); |
51 | 51 | $this->testWrite($domain); |
@@ -60,54 +60,54 @@ discard block |
||
60 | 60 | } |
61 | 61 | private function testWrite($domain){ |
62 | 62 | $test = new Testing(); |
63 | - if( $test->testWriteEventFailedLogin($domain) AND $test->testWritable($domain)){ |
|
64 | - $this->line('<fg=default>Auto Lock : <fg=green>OK'); |
|
63 | + if( $test->testWriteEventFailedLogin($domain) AND $test->testWritable($domain)){ |
|
64 | + $this->line('<fg=default>Auto Lock : <fg=green>OK'); |
|
65 | 65 | } elseif(!$test->testWritable($domain)){ |
66 | 66 | $this->success += 1; |
67 | 67 | $this->line('<fg=default>Auto Lock : <fg=yellow>Warning (Permission denied)'); |
68 | 68 | } else{ |
69 | 69 | $this->error += 1; |
70 | - $this->line('<fg=default>Auto Lock : <fg=red>Failed'); |
|
70 | + $this->line('<fg=default>Auto Lock : <fg=red>Failed'); |
|
71 | 71 | } |
72 | 72 | } |
73 | 73 | private function testManualLock($domain){ |
74 | 74 | $test = new Testing(); |
75 | - if( $test->testManualLocking($domain)){ |
|
75 | + if( $test->testManualLocking($domain)){ |
|
76 | 76 | $this->success += 1; |
77 | - $this->line('<fg=default>Manual Lock : <fg=green>OK'); |
|
77 | + $this->line('<fg=default>Manual Lock : <fg=green>OK'); |
|
78 | 78 | } else{ |
79 | 79 | $this->error += 1; |
80 | - $this->line('<fg=default>Manual Lock : <fg=red>Failed'); |
|
80 | + $this->line('<fg=default>Manual Lock : <fg=red>Failed'); |
|
81 | 81 | } |
82 | 82 | } |
83 | 83 | private function testUnlock($domain){ |
84 | 84 | $test = new Testing(); |
85 | - if( $test->testUnlocking($domain)){ |
|
86 | - $this->success += 1; |
|
87 | - $this->line('<fg=default>Unlock Account : <fg=green>OK'); |
|
85 | + if( $test->testUnlocking($domain)){ |
|
86 | + $this->success += 1; |
|
87 | + $this->line('<fg=default>Unlock Account : <fg=green>OK'); |
|
88 | 88 | } else{ |
89 | - $this->error += 1; |
|
90 | - $this->line('<fg=default>Unlock Account : <fg=red>Failed'); |
|
89 | + $this->error += 1; |
|
90 | + $this->line('<fg=default>Unlock Account : <fg=red>Failed'); |
|
91 | 91 | } |
92 | 92 | } |
93 | 93 | |
94 | 94 | private function testLocked($domain){ |
95 | 95 | $test = new Testing(); |
96 | - if( $test->testLockLogin($domain)){ |
|
97 | - $this->success += 1; |
|
98 | - $this->line('<fg=default>Try Login with locked account : <fg=green>Account is Locked'); |
|
96 | + if( $test->testLockLogin($domain)){ |
|
97 | + $this->success += 1; |
|
98 | + $this->line('<fg=default>Try Login with locked account : <fg=green>Account is Locked'); |
|
99 | 99 | } else{ |
100 | - $this->error += 1; |
|
101 | - $this->line('<fg=default>Try Login with locked account : <fg=red>Account logged in'); |
|
100 | + $this->error += 1; |
|
101 | + $this->line('<fg=default>Try Login with locked account : <fg=red>Account logged in'); |
|
102 | 102 | } |
103 | 103 | } |
104 | 104 | |
105 | 105 | private function testConfigurations(){ |
106 | - $test = new Testing(); |
|
107 | - $res = $test->testConfig(); |
|
106 | + $test = new Testing(); |
|
107 | + $res = $test->testConfig(); |
|
108 | 108 | |
109 | - $table = new Table($this->output); |
|
110 | - $this->line('<fg=cyan>Testing Config:'); |
|
109 | + $table = new Table($this->output); |
|
110 | + $this->line('<fg=cyan>Testing Config:'); |
|
111 | 111 | $table->setRows([ |
112 | 112 | ['<fg=default>login_attemps',isset($res['login_attemps']) ? $res['login_attemps']:"<fg=red>Not Found"], |
113 | 113 | ['<fg=default>logging',isset($res['logging']) ? $res['logging']:"<fg=red>Not Found"], |
@@ -120,11 +120,11 @@ discard block |
||
120 | 120 | ]); |
121 | 121 | $table->render(); |
122 | 122 | |
123 | - if($res['err'] > 0 AND !empty($res['file'])){ |
|
124 | - $this->line('<fg=red>Testing config failed, testing is canceled.'); |
|
125 | - $this->line($res['file']); |
|
126 | - exit(); |
|
127 | - } |
|
123 | + if($res['err'] > 0 AND !empty($res['file'])){ |
|
124 | + $this->line('<fg=red>Testing config failed, testing is canceled.'); |
|
125 | + $this->line($res['file']); |
|
126 | + exit(); |
|
127 | + } |
|
128 | 128 | |
129 | 129 | } |
130 | 130 |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | } |
22 | 22 | |
23 | 23 | if(is_bool(config('irfa.lockout.logging'))){ |
24 | - $ret['logging'] = '<fg=green>OK'; |
|
24 | + $ret['logging'] = '<fg=green>OK'; |
|
25 | 25 | } else{ |
26 | 26 | |
27 | 27 | $ret['err'] +=1; |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | $ret['lockout_file_path'] = '<fg=yellow>Write Permission Denied in '.config('irfa.lockout.lockout_file_path'); |
42 | 42 | } |
43 | 43 | |
44 | - if(!empty(config('irfa.lockout.redirect_url'))){ |
|
44 | + if(!empty(config('irfa.lockout.redirect_url'))){ |
|
45 | 45 | $ret['redirect_url'] = '<fg=green>OK'; |
46 | 46 | } else{ |
47 | 47 | |
@@ -60,8 +60,8 @@ discard block |
||
60 | 60 | if(!empty(config('irfa.lockout.protected_middleware_group'))){ |
61 | 61 | $ret['protected_middleware_group'] = '<fg=green>OK'; |
62 | 62 | } else{ |
63 | - $ret['err'] +=1; |
|
64 | - $ret['protected_middleware_group'] = '<fg=yellow>Must be provided'; |
|
63 | + $ret['err'] +=1; |
|
64 | + $ret['protected_middleware_group'] = '<fg=yellow>Must be provided'; |
|
65 | 65 | } |
66 | 66 | } else{ |
67 | 67 | |
@@ -82,30 +82,30 @@ discard block |
||
82 | 82 | |
83 | 83 | return $ret; |
84 | 84 | } |
85 | - public function testWriteEventFailedLogin($username){ |
|
85 | + public function testWriteEventFailedLogin($username){ |
|
86 | 86 | |
87 | - $this->eventFailedLogin($username); |
|
87 | + $this->eventFailedLogin($username); |
|
88 | 88 | |
89 | - $input = $username; |
|
90 | - $dir = config('irfa.lockout.lockout_file_path'); |
|
91 | - $path = $dir.md5($input); |
|
89 | + $input = $username; |
|
90 | + $dir = config('irfa.lockout.lockout_file_path'); |
|
91 | + $path = $dir.md5($input); |
|
92 | 92 | |
93 | - if(File::exists($path)) |
|
93 | + if(File::exists($path)) |
|
94 | 94 | { |
95 | - return true; |
|
95 | + return true; |
|
96 | 96 | } |
97 | - return false; |
|
97 | + return false; |
|
98 | 98 | } |
99 | 99 | public function testWritable($username){ |
100 | - $input = $username; |
|
101 | - $dir = config('irfa.lockout.lockout_file_path'); |
|
102 | - $path = $dir.md5($input); |
|
100 | + $input = $username; |
|
101 | + $dir = config('irfa.lockout.lockout_file_path'); |
|
102 | + $path = $dir.md5($input); |
|
103 | 103 | |
104 | - if(is_writable($path)) |
|
104 | + if(is_writable($path)) |
|
105 | 105 | { |
106 | - return true; |
|
106 | + return true; |
|
107 | 107 | } |
108 | - return false; |
|
108 | + return false; |
|
109 | 109 | } |
110 | 110 | |
111 | 111 | public function testManualLocking($username){ |
@@ -5,31 +5,31 @@ |
||
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 $permission_code; |
|
8 | + protected $ip; |
|
9 | + protected $input=null; |
|
10 | + protected $dir; |
|
11 | + protected $path; |
|
12 | + protected $attemps; |
|
13 | + protected $permission_code; |
|
14 | 14 | |
15 | - /** |
|
16 | - * Initializing variable. |
|
17 | - * |
|
18 | - * @return void |
|
19 | - */ |
|
20 | - protected function initVar(){ |
|
21 | - if(!empty(config('irfa.lockout'))){ |
|
22 | - $this->ip = Request::ip(); |
|
23 | - $this->input = Request::input(config('irfa.lockout.input_name')); |
|
24 | - $this->dir = config('irfa.lockout.lockout_file_path'); |
|
25 | - $this->attemps = config('irfa.lockout.login_attemps'); |
|
26 | - $this->path = $this->dir.md5($this->input); |
|
27 | - } |
|
28 | - } |
|
15 | + /** |
|
16 | + * Initializing variable. |
|
17 | + * |
|
18 | + * @return void |
|
19 | + */ |
|
20 | + protected function initVar(){ |
|
21 | + if(!empty(config('irfa.lockout'))){ |
|
22 | + $this->ip = Request::ip(); |
|
23 | + $this->input = Request::input(config('irfa.lockout.input_name')); |
|
24 | + $this->dir = config('irfa.lockout.lockout_file_path'); |
|
25 | + $this->attemps = config('irfa.lockout.login_attemps'); |
|
26 | + $this->path = $this->dir.md5($this->input); |
|
27 | + } |
|
28 | + } |
|
29 | 29 | |
30 | - protected function setPath($username){ |
|
31 | - $this->path = $this->dir.md5($username); |
|
32 | - $this->input = $username; |
|
33 | - } |
|
30 | + protected function setPath($username){ |
|
31 | + $this->path = $this->dir.md5($username); |
|
32 | + $this->input = $username; |
|
33 | + } |
|
34 | 34 | |
35 | - } |
|
36 | 35 | \ No newline at end of file |
36 | + } |
|
37 | 37 | \ No newline at end of file |