@@ -41,15 +41,15 @@ |
||
41 | 41 | { |
42 | 42 | $ret = $core->unlock_account($this->argument('username')); |
43 | 43 | $table = new Table($this->output); |
44 | - $read_enc = json_decode( $ret); |
|
44 | + $read_enc = json_decode($ret); |
|
45 | 45 | $time = $read_enc->last_attemps; |
46 | 46 | $attemps = $read_enc->attemps; |
47 | 47 | $ip = $read_enc->ip; |
48 | 48 | $table->setRows([ |
49 | - ['<fg=cyan>Login attemps', $attemps], |
|
50 | - ['<fg=cyan>Last login attemps',$time], |
|
51 | - ['<fg=cyan>Last IP Address',empty(end($ip))? "unknown":end($ip)], |
|
52 | - ['<fg=cyan>Unlocked at',date('Y-m-d H:i:s', time())], |
|
49 | + ['<fg=cyan>Login attemps', $attemps], |
|
50 | + ['<fg=cyan>Last login attemps', $time], |
|
51 | + ['<fg=cyan>Last IP Address', empty(end($ip)) ? "unknown" : end($ip)], |
|
52 | + ['<fg=cyan>Unlocked at', date('Y-m-d H:i:s', time())], |
|
53 | 53 | ]); |
54 | 54 | $table->render(); |
55 | 55 | // $this->line('<fg=yellow>Valid input is lock, unlock, and attemps.'); |
@@ -41,14 +41,14 @@ |
||
41 | 41 | { |
42 | 42 | $ret = $core->check_account($this->argument('username')); |
43 | 43 | $table = new Table($this->output); |
44 | - $read_enc = json_decode( $ret); |
|
44 | + $read_enc = json_decode($ret); |
|
45 | 45 | $time = $read_enc->last_attemps; |
46 | 46 | $attemps = $read_enc->attemps; |
47 | 47 | $ip = $read_enc->ip; |
48 | 48 | $table->setRows([ |
49 | - ['<fg=yellow>Login attemps', $attemps], |
|
50 | - ['<fg=yellow>Last login attemps',$time], |
|
51 | - ['<fg=yellow>Last IP Address',empty(end($ip))? "unknown":end($ip)],]); |
|
49 | + ['<fg=yellow>Login attemps', $attemps], |
|
50 | + ['<fg=yellow>Last login attemps', $time], |
|
51 | + ['<fg=yellow>Last IP Address', empty(end($ip)) ? "unknown" : end($ip)], ]); |
|
52 | 52 | $table->render(); |
53 | 53 | // $this->line('<fg=yellow>Valid input is lock, unlock, and attemps.'); |
54 | 54 |
@@ -40,14 +40,14 @@ |
||
40 | 40 | public function handle(Core $core) |
41 | 41 | { |
42 | 42 | $this->line('Cleaning locked user...'); |
43 | - if($core->clear_all()){ |
|
43 | + if ($core->clear_all()) { |
|
44 | 44 | $table = new Table($this->output); |
45 | 45 | $table->setRows([ |
46 | 46 | ['<fg=green>Locked Account(s) Cleared.'], |
47 | 47 | |
48 | 48 | ]); |
49 | 49 | $table->render(); |
50 | - } else{ |
|
50 | + } else { |
|
51 | 51 | $this->line('<fg=red> Clearing failed.'); |
52 | 52 | } |
53 | 53 | } |
@@ -40,14 +40,14 @@ |
||
40 | 40 | public function handle(Core $core) |
41 | 41 | { |
42 | 42 | $this->line('Locking '.$this->argument('username').'...'); |
43 | - if($core->lock_account($this->argument('username'))!="error"){ |
|
43 | + if ($core->lock_account($this->argument('username')) != "error") { |
|
44 | 44 | $table = new Table($this->output); |
45 | 45 | $table->setRows([ |
46 | 46 | ['<fg=green>'.$this->argument('username').' successfully locked.'], |
47 | 47 | |
48 | 48 | ]); |
49 | 49 | $table->render(); |
50 | - } else{ |
|
50 | + } else { |
|
51 | 51 | $this->line('<fg=red> Locking failed.'); |
52 | 52 | } |
53 | 53 | } |
@@ -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 | } |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | $this->informasi(); |
42 | 42 | } |
43 | 43 | |
44 | - private function informasi(){ |
|
44 | + private function informasi() { |
|
45 | 45 | $this->line(" _____ __ _ _ _ |
46 | 46 | |_ _| / _| | | | | | | |
47 | 47 | | | _ __| |_ __ _ ______| | ___ ___| | _____ _ _| |_ |
@@ -59,24 +59,24 @@ discard block |
||
59 | 59 | $this->line('<fg=yellow>Commands'); |
60 | 60 | $table = new Table($this->output); |
61 | 61 | $table->setRows([ |
62 | - ['<fg=cyan>php artisan lockout:lock {username}','<fg=default>locking account'], |
|
63 | - ['<fg=cyan>php artisan lockout:unlock {username}','<fg=default>unlocking account'], |
|
64 | - ['<fg=cyan>php artisan lockout:check {username}','<fg=default>checking account with details'], |
|
65 | - ['<fg=cyan>php artisan lockout:is-locked {username}','<fg=default>checking account (return boolean)'], |
|
66 | - ['<fg=cyan>php artisan lockout:clear','<fg=default>unlocking all account']] |
|
62 | + ['<fg=cyan>php artisan lockout:lock {username}', '<fg=default>locking account'], |
|
63 | + ['<fg=cyan>php artisan lockout:unlock {username}', '<fg=default>unlocking account'], |
|
64 | + ['<fg=cyan>php artisan lockout:check {username}', '<fg=default>checking account with details'], |
|
65 | + ['<fg=cyan>php artisan lockout:is-locked {username}', '<fg=default>checking account (return boolean)'], |
|
66 | + ['<fg=cyan>php artisan lockout:clear', '<fg=default>unlocking all account']] |
|
67 | 67 | ); |
68 | 68 | $table->render(); |
69 | 69 | $this->line('<fg=default>-------------------------------------------------------------------------------'); |
70 | 70 | $this->line('<fg=yellow>Configuration'); |
71 | - foreach($conf as $key => $val){ |
|
72 | - if(is_array($val)){ |
|
73 | - foreach($val as $v){ |
|
71 | + foreach ($conf as $key => $val) { |
|
72 | + if (is_array($val)) { |
|
73 | + foreach ($val as $v) { |
|
74 | 74 | $vl .= $v.", "; |
75 | 75 | } |
76 | - } else{ |
|
76 | + } else { |
|
77 | 77 | $vl = $val; |
78 | 78 | } |
79 | - $row[] = ['<fg=default>'.$key,' <fg=cyan>'.$vl]; |
|
79 | + $row[] = ['<fg=default>'.$key, ' <fg=cyan>'.$vl]; |
|
80 | 80 | } |
81 | 81 | // dd($row); |
82 | 82 | $table = new Table($this->output); |
@@ -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.'); |
@@ -3,7 +3,7 @@ discard block |
||
3 | 3 | namespace Irfa\Lockout\Console\Commands; |
4 | 4 | |
5 | 5 | use Illuminate\Console\Command; |
6 | -use Irfa\Lockout\Func\Core,Lockout; |
|
6 | +use Irfa\Lockout\Func\Core, Lockout; |
|
7 | 7 | use Symfony\Component\Console\Helper\Table; |
8 | 8 | |
9 | 9 | class CheckLockedCommands extends Command |
@@ -42,14 +42,14 @@ discard block |
||
42 | 42 | $username = $this->argument('username'); |
43 | 43 | $lock = Lockout::isLocked($username); |
44 | 44 | $table = new Table($this->output); |
45 | - if($lock){ |
|
45 | + if ($lock) { |
|
46 | 46 | $table->setRows([ |
47 | - ['<fg=yellow>'.$username.' is locked',]]); |
|
47 | + ['<fg=yellow>'.$username.' is locked', ]]); |
|
48 | 48 | $table->render(); |
49 | 49 | $this->line('<fg=default>Run <fg=cyan>php artisan lockout:unlock '.$username.'<fg=default> to unlock account.'); |
50 | - } else{ |
|
50 | + } else { |
|
51 | 51 | $table->setRows([ |
52 | - ['<fg=green>'.$username.' is unlocked',]]); |
|
52 | + ['<fg=green>'.$username.' is unlocked', ]]); |
|
53 | 53 | $table->render(); |
54 | 54 | $this->line('<fg=default>Run <fg=cyan>php artisan lockout:lock '.$username.'<fg=default> to lock account.'); |
55 | 55 | } |
@@ -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 | } |
@@ -6,58 +6,58 @@ |
||
6 | 6 | |
7 | 7 | class Lockout extends Core { |
8 | 8 | |
9 | - public function unlock($username){ |
|
10 | - if(is_array($username)){ |
|
11 | - foreach($username as $key){ |
|
9 | + public function unlock($username) { |
|
10 | + if (is_array($username)) { |
|
11 | + foreach ($username as $key) { |
|
12 | 12 | $this->_unlock($key); |
13 | 13 | } |
14 | - } else{ |
|
14 | + } else { |
|
15 | 15 | $this->_unlock($username); |
16 | 16 | } |
17 | 17 | return true; |
18 | 18 | } |
19 | - public function isLocked($username){ |
|
19 | + public function isLocked($username) { |
|
20 | 20 | return $this->is_locked($username); |
21 | 21 | } |
22 | - public function message(){ |
|
22 | + public function message() { |
|
23 | 23 | return $this->showMessage(); |
24 | 24 | } |
25 | - public function lock($username){ |
|
26 | - if(is_array($username)){ |
|
27 | - foreach($username as $key){ |
|
25 | + public function lock($username) { |
|
26 | + if (is_array($username)) { |
|
27 | + foreach ($username as $key) { |
|
28 | 28 | $this->_lock($key); |
29 | 29 | } |
30 | - } else{ |
|
30 | + } else { |
|
31 | 31 | $this->_lock($username); |
32 | 32 | } |
33 | 33 | return true; |
34 | 34 | } |
35 | 35 | public function check($username) { |
36 | 36 | $ret = null; |
37 | - if(is_array($username)){ |
|
38 | - foreach($username as $key){ |
|
37 | + if (is_array($username)) { |
|
38 | + foreach ($username as $key) { |
|
39 | 39 | $get = $this->_check($key); |
40 | - if(!empty($get)){ |
|
40 | + if (!empty($get)) { |
|
41 | 41 | $ret[] = $get; |
42 | 42 | } |
43 | 43 | } |
44 | - } else{ |
|
44 | + } else { |
|
45 | 45 | $ret = $this->_check($username); |
46 | 46 | } |
47 | 47 | $ret = json_encode($ret); |
48 | 48 | return json_decode($ret); |
49 | 49 | } |
50 | - public function clearLocked(){ |
|
50 | + public function clearLocked() { |
|
51 | 51 | return $this->clear_all(); |
52 | 52 | } |
53 | 53 | |
54 | - private function _unlock($username){ |
|
54 | + private function _unlock($username) { |
|
55 | 55 | $this->unlock_account($username); |
56 | 56 | } |
57 | - private function _lock($username){ |
|
57 | + private function _lock($username) { |
|
58 | 58 | $this->lock_account($username); |
59 | 59 | } |
60 | - private function _check($username){ |
|
61 | - return json_decode($this->check_account($username),true); |
|
60 | + private function _check($username) { |
|
61 | + return json_decode($this->check_account($username), true); |
|
62 | 62 | } |
63 | 63 | } |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | |
32 | 32 | $router = $this->app['router']; |
33 | 33 | $this->commands($this->commands); |
34 | - if(!empty(config('irfa.lockout'))){ |
|
34 | + if (!empty(config('irfa.lockout'))) { |
|
35 | 35 | \Illuminate\Support\Facades\Event::listen( |
36 | 36 | \Illuminate\Auth\Events\Failed::class, |
37 | 37 | LockoutAccount::class |
@@ -40,13 +40,13 @@ discard block |
||
40 | 40 | \Illuminate\Auth\Events\Authenticated::class, |
41 | 41 | CleanLockoutAccount::class |
42 | 42 | ); |
43 | - if(in_array('api', config('irfa.lockout.protected_middleware_group'))){ |
|
43 | + if (in_array('api', config('irfa.lockout.protected_middleware_group'))) { |
|
44 | 44 | $router->pushMiddlewareToGroup('api', \Irfa\Lockout\Middleware\ApiLockAccount::class); |
45 | 45 | } |
46 | - if(in_array('web', config('irfa.lockout.protected_middleware_group'))){ |
|
46 | + if (in_array('web', config('irfa.lockout.protected_middleware_group'))) { |
|
47 | 47 | $router->pushMiddlewareToGroup('web', \Irfa\Lockout\Middleware\LockAccount::class); |
48 | 48 | } |
49 | - if(in_array(null, config('irfa.lockout.protected_middleware_group'))){ |
|
49 | + if (in_array(null, config('irfa.lockout.protected_middleware_group'))) { |
|
50 | 50 | $router->pushMiddlewareToGroup('web', \Irfa\Lockout\Middleware\LockAccount::class); |
51 | 51 | } |
52 | 52 | } |
@@ -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 |
@@ -10,8 +10,8 @@ discard block |
||
10 | 10 | |
11 | 11 | class TestingCommands extends Command |
12 | 12 | { |
13 | - private $error=0; |
|
14 | - private $success=0; |
|
13 | + private $error = 0; |
|
14 | + private $success = 0; |
|
15 | 15 | /** |
16 | 16 | * The name and signature of the console command. |
17 | 17 | * |
@@ -52,75 +52,75 @@ discard block |
||
52 | 52 | $this->testManualLock($domain); |
53 | 53 | $this->testLocked($domain); |
54 | 54 | $this->testUnlock($domain); |
55 | - $end=time(); |
|
55 | + $end = time(); |
|
56 | 56 | $this->line('<fg=default>--------------------------------------------'); |
57 | - $this->line('<fg=default>Tested at: '.date('Y-m-d H:m:s',time())); |
|
58 | - $this->line('<fg=default>Test time : '.(round(microtime(true) - $curTime,3)*1000)." ms"); |
|
57 | + $this->line('<fg=default>Tested at: '.date('Y-m-d H:m:s', time())); |
|
58 | + $this->line('<fg=default>Test time : '.(round(microtime(true)-$curTime, 3) * 1000)." ms"); |
|
59 | 59 | |
60 | 60 | } |
61 | - private function testWrite($domain){ |
|
61 | + private function testWrite($domain) { |
|
62 | 62 | $test = new Testing(); |
63 | - if( $test->testWriteEventFailedLogin($domain) AND $test->testWritable($domain)){ |
|
63 | + if ($test->testWriteEventFailedLogin($domain) AND $test->testWritable($domain)) { |
|
64 | 64 | $this->line('<fg=default>Auto Lock : <fg=green>OK'); |
65 | - } elseif(!$test->testWritable($domain)){ |
|
65 | + } elseif (!$test->testWritable($domain)) { |
|
66 | 66 | $this->success += 1; |
67 | 67 | $this->line('<fg=default>Auto Lock : <fg=yellow>Warning (Permission denied)'); |
68 | - } else{ |
|
68 | + } else { |
|
69 | 69 | $this->error += 1; |
70 | 70 | $this->line('<fg=default>Auto Lock : <fg=red>Failed'); |
71 | 71 | } |
72 | 72 | } |
73 | - private function testManualLock($domain){ |
|
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 | 77 | $this->line('<fg=default>Manual Lock : <fg=green>OK'); |
78 | - } else{ |
|
78 | + } else { |
|
79 | 79 | $this->error += 1; |
80 | 80 | $this->line('<fg=default>Manual Lock : <fg=red>Failed'); |
81 | 81 | } |
82 | 82 | } |
83 | - private function testUnlock($domain){ |
|
83 | + private function testUnlock($domain) { |
|
84 | 84 | $test = new Testing(); |
85 | - if( $test->testUnlocking($domain)){ |
|
85 | + if ($test->testUnlocking($domain)) { |
|
86 | 86 | $this->success += 1; |
87 | 87 | $this->line('<fg=default>Unlock Account : <fg=green>OK'); |
88 | - } else{ |
|
88 | + } else { |
|
89 | 89 | $this->error += 1; |
90 | 90 | $this->line('<fg=default>Unlock Account : <fg=red>Failed'); |
91 | 91 | } |
92 | 92 | } |
93 | 93 | |
94 | - private function testLocked($domain){ |
|
94 | + private function testLocked($domain) { |
|
95 | 95 | $test = new Testing(); |
96 | - if( $test->testLockLogin($domain)){ |
|
96 | + if ($test->testLockLogin($domain)) { |
|
97 | 97 | $this->success += 1; |
98 | 98 | $this->line('<fg=default>Try Login with locked account : <fg=green>Account is Locked'); |
99 | - } else{ |
|
99 | + } else { |
|
100 | 100 | $this->error += 1; |
101 | 101 | $this->line('<fg=default>Try Login with locked account : <fg=red>Account logged in'); |
102 | 102 | } |
103 | 103 | } |
104 | 104 | |
105 | - private function testConfigurations(){ |
|
105 | + private function testConfigurations() { |
|
106 | 106 | $test = new Testing(); |
107 | 107 | $res = $test->testConfig(); |
108 | 108 | |
109 | 109 | $table = new Table($this->output); |
110 | 110 | $this->line('<fg=cyan>Testing Config:'); |
111 | 111 | $table->setRows([ |
112 | - ['<fg=default>login_attemps',isset($res['login_attemps']) ? $res['login_attemps']:"<fg=red>Not Found"], |
|
113 | - ['<fg=default>logging',isset($res['logging']) ? $res['logging']:"<fg=red>Not Found"], |
|
114 | - ['<fg=default>input_name',isset($res['input_name']) ? $res['input_name']:"<fg=red>Not Found"], |
|
115 | - ['<fg=default>redirect_url',isset($res['redirect_url']) ? $res['redirect_url']:"<fg=red>Not Found"], |
|
116 | - ['<fg=default>protected_action_path',isset($res['protected_action_path']) ? $res['protected_action_path']:"<fg=red>Not Found"], |
|
117 | - ['<fg=default>protected_middleware_group',isset($res['protected_middleware_group']) ? $res['protected_middleware_group']:"<fg=red>Not Found"], |
|
118 | - ['<fg=default>message_name',isset($res['message_name']) ? $res['message_name']:"<fg=red>Not Found"], |
|
112 | + ['<fg=default>login_attemps', isset($res['login_attemps']) ? $res['login_attemps'] : "<fg=red>Not Found"], |
|
113 | + ['<fg=default>logging', isset($res['logging']) ? $res['logging'] : "<fg=red>Not Found"], |
|
114 | + ['<fg=default>input_name', isset($res['input_name']) ? $res['input_name'] : "<fg=red>Not Found"], |
|
115 | + ['<fg=default>redirect_url', isset($res['redirect_url']) ? $res['redirect_url'] : "<fg=red>Not Found"], |
|
116 | + ['<fg=default>protected_action_path', isset($res['protected_action_path']) ? $res['protected_action_path'] : "<fg=red>Not Found"], |
|
117 | + ['<fg=default>protected_middleware_group', isset($res['protected_middleware_group']) ? $res['protected_middleware_group'] : "<fg=red>Not Found"], |
|
118 | + ['<fg=default>message_name', isset($res['message_name']) ? $res['message_name'] : "<fg=red>Not Found"], |
|
119 | 119 | |
120 | 120 | ]); |
121 | 121 | $table->render(); |
122 | 122 | |
123 | - if($res['err'] > 0 AND !empty($res['file'])){ |
|
123 | + if ($res['err'] > 0 AND !empty($res['file'])) { |
|
124 | 124 | $this->line('<fg=red>Testing config failed, testing is canceled.'); |
125 | 125 | $this->line($res['file']); |
126 | 126 | exit(); |