@@ -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){ |
@@ -8,81 +8,81 @@ discard block |
||
| 8 | 8 | |
| 9 | 9 | class Testing extends Core { |
| 10 | 10 | |
| 11 | - public function testConfig(){ |
|
| 12 | - $ret=[]; |
|
| 11 | + public function testConfig() { |
|
| 12 | + $ret = []; |
|
| 13 | 13 | $ret['err'] = 0; |
| 14 | - if(!empty(config('irfa.lockout'))){ |
|
| 15 | - if(is_numeric(config('irfa.lockout.login_attemps'))){ |
|
| 14 | + if (!empty(config('irfa.lockout'))) { |
|
| 15 | + if (is_numeric(config('irfa.lockout.login_attemps'))) { |
|
| 16 | 16 | $ret['login_attemps'] = '<fg=green>OK'; |
| 17 | - } else{ |
|
| 17 | + } else { |
|
| 18 | 18 | |
| 19 | - $ret['err'] +=1; |
|
| 20 | - $ret['login_attemps'] ='<fg=yellow>Must be a number'; |
|
| 19 | + $ret['err'] += 1; |
|
| 20 | + $ret['login_attemps'] = '<fg=yellow>Must be a number'; |
|
| 21 | 21 | } |
| 22 | 22 | |
| 23 | - if(is_bool(config('irfa.lockout.logging'))){ |
|
| 23 | + if (is_bool(config('irfa.lockout.logging'))) { |
|
| 24 | 24 | $ret['logging'] = '<fg=green>OK'; |
| 25 | - } else{ |
|
| 25 | + } else { |
|
| 26 | 26 | |
| 27 | - $ret['err'] +=1; |
|
| 27 | + $ret['err'] += 1; |
|
| 28 | 28 | $ret['logging'] = '<fg=yellow>Must be a Boolean'; |
| 29 | 29 | } |
| 30 | 30 | |
| 31 | - if(is_string(config('irfa.lockout.input_name'))){ |
|
| 31 | + if (is_string(config('irfa.lockout.input_name'))) { |
|
| 32 | 32 | $ret['input_name'] = '<fg=green>OK'; |
| 33 | - } else{ |
|
| 33 | + } else { |
|
| 34 | 34 | |
| 35 | - $ret['err'] +=1; |
|
| 35 | + $ret['err'] += 1; |
|
| 36 | 36 | $ret['input_name'] = '<fg=yellow>Must be a String'; |
| 37 | 37 | } |
| 38 | - if(is_writable(config('irfa.lockout.lockout_file_path'))){ |
|
| 38 | + if (is_writable(config('irfa.lockout.lockout_file_path'))) { |
|
| 39 | 39 | $ret['lockout_file_path'] = '<fg=green>OK'; |
| 40 | - } else{ |
|
| 40 | + } else { |
|
| 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 | - } else{ |
|
| 46 | + } else { |
|
| 47 | 47 | |
| 48 | - $ret['err'] +=1; |
|
| 48 | + $ret['err'] += 1; |
|
| 49 | 49 | $ret['redirect_url'] = '<fg=yellow>Must be provided'; |
| 50 | 50 | } |
| 51 | - if(is_array(config('irfa.lockout.protected_action_path'))){ |
|
| 51 | + if (is_array(config('irfa.lockout.protected_action_path'))) { |
|
| 52 | 52 | $ret['protected_action_path'] = '<fg=green>OK'; |
| 53 | - } else{ |
|
| 53 | + } else { |
|
| 54 | 54 | |
| 55 | - $ret['err'] +=1; |
|
| 55 | + $ret['err'] += 1; |
|
| 56 | 56 | $ret['protected_action_path'] = '<fg=yellow>Must be array'; |
| 57 | 57 | } |
| 58 | 58 | |
| 59 | - if(is_array(config('irfa.lockout.protected_middleware_group'))){ |
|
| 60 | - if(!empty(config('irfa.lockout.protected_middleware_group'))){ |
|
| 59 | + if (is_array(config('irfa.lockout.protected_middleware_group'))) { |
|
| 60 | + if (!empty(config('irfa.lockout.protected_middleware_group'))) { |
|
| 61 | 61 | $ret['protected_middleware_group'] = '<fg=green>OK'; |
| 62 | - } else{ |
|
| 63 | - $ret['err'] +=1; |
|
| 62 | + } else { |
|
| 63 | + $ret['err'] += 1; |
|
| 64 | 64 | $ret['protected_middleware_group'] = '<fg=yellow>Must be provided'; |
| 65 | 65 | } |
| 66 | - } else{ |
|
| 66 | + } else { |
|
| 67 | 67 | |
| 68 | - $ret['err'] +=1; |
|
| 68 | + $ret['err'] += 1; |
|
| 69 | 69 | $ret['protected_middleware_group'] = '<fg=yellow>Must be array'; |
| 70 | 70 | } |
| 71 | - if(is_string(config('irfa.lockout.message_name'))){ |
|
| 71 | + if (is_string(config('irfa.lockout.message_name'))) { |
|
| 72 | 72 | $ret['message_name'] = '<fg=green>OK'; |
| 73 | - } else{ |
|
| 73 | + } else { |
|
| 74 | 74 | |
| 75 | - $ret['err'] +=1; |
|
| 75 | + $ret['err'] += 1; |
|
| 76 | 76 | $ret['message_name'] = '<fg=yellow>Must be a String'; |
| 77 | 77 | } |
| 78 | - } else{ |
|
| 79 | - $ret['err'] +=1; |
|
| 78 | + } else { |
|
| 79 | + $ret['err'] += 1; |
|
| 80 | 80 | $ret['file'] = "<fg=yellow> Could't find config file. Try to run <fg=cyan>php artisan vendor:publish --tag=lockout-account"; |
| 81 | 81 | } |
| 82 | 82 | |
| 83 | 83 | return $ret; |
| 84 | 84 | } |
| 85 | - public function testWriteEventFailedLogin($username){ |
|
| 85 | + public function testWriteEventFailedLogin($username) { |
|
| 86 | 86 | |
| 87 | 87 | $this->eventFailedLogin($username); |
| 88 | 88 | |
@@ -90,53 +90,53 @@ discard block |
||
| 90 | 90 | $dir = config('irfa.lockout.lockout_file_path'); |
| 91 | 91 | $path = $dir.md5($input); |
| 92 | 92 | |
| 93 | - if(File::exists($path)) |
|
| 93 | + if (File::exists($path)) |
|
| 94 | 94 | { |
| 95 | 95 | return true; |
| 96 | 96 | } |
| 97 | 97 | return false; |
| 98 | 98 | } |
| 99 | - public function testWritable($username){ |
|
| 99 | + public function testWritable($username) { |
|
| 100 | 100 | $input = $username; |
| 101 | 101 | $dir = config('irfa.lockout.lockout_file_path'); |
| 102 | 102 | $path = $dir.md5($input); |
| 103 | 103 | |
| 104 | - if(is_writable($path)) |
|
| 104 | + if (is_writable($path)) |
|
| 105 | 105 | { |
| 106 | 106 | return true; |
| 107 | 107 | } |
| 108 | 108 | return false; |
| 109 | 109 | } |
| 110 | 110 | |
| 111 | - public function testManualLocking($username){ |
|
| 111 | + public function testManualLocking($username) { |
|
| 112 | 112 | $input = $username; |
| 113 | 113 | $dir = config('irfa.lockout.lockout_file_path'); |
| 114 | 114 | $path = $dir.md5($input); |
| 115 | 115 | |
| 116 | - if($this->lock_account($username)) |
|
| 116 | + if ($this->lock_account($username)) |
|
| 117 | 117 | { |
| 118 | 118 | return true; |
| 119 | 119 | } |
| 120 | 120 | return false; |
| 121 | 121 | } |
| 122 | 122 | |
| 123 | - public function testUnlocking($username){ |
|
| 123 | + public function testUnlocking($username) { |
|
| 124 | 124 | $input = $username; |
| 125 | 125 | $dir = config('irfa.lockout.lockout_file_path'); |
| 126 | 126 | $path = $dir.md5($input); |
| 127 | - $unlock = $this->test_unlock_account($username); |
|
| 128 | - if($unlock) |
|
| 127 | + $unlock = $this->test_unlock_account($username); |
|
| 128 | + if ($unlock) |
|
| 129 | 129 | { |
| 130 | 130 | return true; |
| 131 | 131 | } |
| 132 | 132 | return false; |
| 133 | 133 | } |
| 134 | - public function testLockLogin($username){ |
|
| 134 | + public function testLockLogin($username) { |
|
| 135 | 135 | $input = $username; |
| 136 | 136 | $dir = config('irfa.lockout.lockout_file_path'); |
| 137 | 137 | $path = $dir.md5($input); |
| 138 | - $unlock = $this->lockLogin($username); |
|
| 139 | - if($unlock) |
|
| 138 | + $unlock = $this->lockLogin($username); |
|
| 139 | + if ($unlock) |
|
| 140 | 140 | { |
| 141 | 141 | return true; |
| 142 | 142 | } |
@@ -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 |
@@ -6,7 +6,7 @@ discard block |
||
| 6 | 6 | class Variable { |
| 7 | 7 | |
| 8 | 8 | protected $ip; |
| 9 | - protected $input=null; |
|
| 9 | + protected $input = null; |
|
| 10 | 10 | protected $dir; |
| 11 | 11 | protected $path; |
| 12 | 12 | protected $attemps; |
@@ -17,8 +17,8 @@ discard block |
||
| 17 | 17 | * |
| 18 | 18 | * @return void |
| 19 | 19 | */ |
| 20 | - protected function initVar(){ |
|
| 21 | - if(!empty(config('irfa.lockout'))){ |
|
| 20 | + protected function initVar() { |
|
| 21 | + if (!empty(config('irfa.lockout'))) { |
|
| 22 | 22 | $this->ip = Request::ip(); |
| 23 | 23 | $this->input = Request::input(config('irfa.lockout.input_name')); |
| 24 | 24 | $this->dir = config('irfa.lockout.lockout_file_path'); |
@@ -27,7 +27,7 @@ discard block |
||
| 27 | 27 | } |
| 28 | 28 | } |
| 29 | 29 | |
| 30 | - protected function setPath($username){ |
|
| 30 | + protected function setPath($username) { |
|
| 31 | 31 | $this->path = $this->dir.md5($username); |
| 32 | 32 | $this->input = $username; |
| 33 | 33 | } |