@@ -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"], |
@@ -121,15 +121,15 @@ discard block |
||
| 121 | 121 | |
| 122 | 122 | ]); |
| 123 | 123 | $table->render(); |
| 124 | - if($res['err'] > 0){ |
|
| 124 | + if($res['err'] > 0){ |
|
| 125 | 125 | $this->line('<fg=red>Config invalid, testing is canceled.'); |
| 126 | 126 | exit(); |
| 127 | - } |
|
| 128 | - if($res['err'] > 0 AND !empty($res['file'])){ |
|
| 129 | - $this->line('<fg=red>Testing config failed, testing is canceled.'); |
|
| 130 | - $this->line($res['file']); |
|
| 131 | - exit(); |
|
| 132 | - } |
|
| 127 | + } |
|
| 128 | + if($res['err'] > 0 AND !empty($res['file'])){ |
|
| 129 | + $this->line('<fg=red>Testing config failed, testing is canceled.'); |
|
| 130 | + $this->line($res['file']); |
|
| 131 | + exit(); |
|
| 132 | + } |
|
| 133 | 133 | |
| 134 | 134 | } |
| 135 | 135 | |
@@ -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{ |