@@ -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'))){ |
@@ -31,30 +31,30 @@ discard block |
||
31 | 31 | |
32 | 32 | return $this->ret; |
33 | 33 | } |
34 | - public function testWriteEventFailedLogin($username){ |
|
34 | + public function testWriteEventFailedLogin($username){ |
|
35 | 35 | |
36 | - $this->eventFailedLogin($username); |
|
36 | + $this->eventFailedLogin($username); |
|
37 | 37 | |
38 | - $input = $username; |
|
39 | - $dir = config('irfa.lockout.lockout_file_path'); |
|
40 | - $path = $dir.md5($input); |
|
38 | + $input = $username; |
|
39 | + $dir = config('irfa.lockout.lockout_file_path'); |
|
40 | + $path = $dir.md5($input); |
|
41 | 41 | |
42 | - if(File::exists($path)) |
|
42 | + if(File::exists($path)) |
|
43 | 43 | { |
44 | - return true; |
|
44 | + return true; |
|
45 | 45 | } |
46 | - return false; |
|
46 | + return false; |
|
47 | 47 | } |
48 | 48 | public function testWritable($username){ |
49 | - $input = $username; |
|
50 | - $dir = config('irfa.lockout.lockout_file_path'); |
|
51 | - $path = $dir.md5($input); |
|
49 | + $input = $username; |
|
50 | + $dir = config('irfa.lockout.lockout_file_path'); |
|
51 | + $path = $dir.md5($input); |
|
52 | 52 | |
53 | - if(is_writable($path)) |
|
53 | + if(is_writable($path)) |
|
54 | 54 | { |
55 | - return true; |
|
55 | + return true; |
|
56 | 56 | } |
57 | - return false; |
|
57 | + return false; |
|
58 | 58 | } |
59 | 59 | |
60 | 60 | public function testManualLocking($username){ |
@@ -102,8 +102,8 @@ discard block |
||
102 | 102 | } |
103 | 103 | |
104 | 104 | private function confLogging(){ |
105 | - if(is_bool(config('irfa.lockout.logging'))){ |
|
106 | - $this->ret['logging'] = '<fg=green>OK'; |
|
105 | + if(is_bool(config('irfa.lockout.logging'))){ |
|
106 | + $this->ret['logging'] = '<fg=green>OK'; |
|
107 | 107 | } else{ |
108 | 108 | |
109 | 109 | $this->ret['err'] +=1; |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | $this->ret['input_name'] = '<fg=yellow>Must be a String'; |
121 | 121 | } |
122 | 122 | } |
123 | - private function confFilePath(){ |
|
123 | + private function confFilePath(){ |
|
124 | 124 | |
125 | 125 | |
126 | 126 | if(is_writable(config('irfa.lockout.lockout_file_path'))){ |
@@ -153,8 +153,8 @@ discard block |
||
153 | 153 | if(!empty(config('irfa.lockout.protected_middleware_group'))){ |
154 | 154 | $this->ret['protected_middleware_group'] = '<fg=green>OK'; |
155 | 155 | } else{ |
156 | - $this->ret['err'] +=1; |
|
157 | - $this->ret['protected_middleware_group'] = '<fg=yellow>Must be provided'; |
|
156 | + $this->ret['err'] +=1; |
|
157 | + $this->ret['protected_middleware_group'] = '<fg=yellow>Must be provided'; |
|
158 | 158 | } |
159 | 159 | } else{ |
160 | 160 | |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | |
165 | 165 | } |
166 | 166 | private function confMessage(){ |
167 | - if(is_string(config('irfa.lockout.message_name'))){ |
|
167 | + if(is_string(config('irfa.lockout.message_name'))){ |
|
168 | 168 | $this->ret['message_name'] = '<fg=green>OK'; |
169 | 169 | } else{ |
170 | 170 |
@@ -9,12 +9,12 @@ discard block |
||
9 | 9 | class Testing extends Core { |
10 | 10 | private $ret = []; |
11 | 11 | |
12 | - public function testConfig(){ |
|
13 | - $this->ret=[]; |
|
12 | + public function testConfig() { |
|
13 | + $this->ret = []; |
|
14 | 14 | $this->ret['err'] = 0; |
15 | 15 | |
16 | 16 | |
17 | - if(!empty(config('irfa.lockout'))){ |
|
17 | + if (!empty(config('irfa.lockout'))) { |
|
18 | 18 | $this->confLoginAttemps(); |
19 | 19 | $this->confLogging(); |
20 | 20 | $this->confInput(); |
@@ -24,14 +24,14 @@ discard block |
||
24 | 24 | $this->confProtectMiddleware(); |
25 | 25 | $this->confMessage(); |
26 | 26 | |
27 | - } else{ |
|
28 | - $this->ret['err'] +=1; |
|
27 | + } else { |
|
28 | + $this->ret['err'] += 1; |
|
29 | 29 | $this->ret['file'] = "<fg=yellow> Could't find config file. Try to run <fg=cyan>php artisan vendor:publish --tag=lockout-account"; |
30 | 30 | } |
31 | 31 | |
32 | 32 | return $this->ret; |
33 | 33 | } |
34 | - public function testWriteEventFailedLogin($username){ |
|
34 | + public function testWriteEventFailedLogin($username) { |
|
35 | 35 | |
36 | 36 | $this->eventFailedLogin($username); |
37 | 37 | |
@@ -39,136 +39,136 @@ discard block |
||
39 | 39 | $dir = config('irfa.lockout.lockout_file_path'); |
40 | 40 | $path = $dir.md5($input); |
41 | 41 | |
42 | - if(File::exists($path)) |
|
42 | + if (File::exists($path)) |
|
43 | 43 | { |
44 | 44 | return true; |
45 | 45 | } |
46 | 46 | return false; |
47 | 47 | } |
48 | - public function testWritable($username){ |
|
48 | + public function testWritable($username) { |
|
49 | 49 | $input = $username; |
50 | 50 | $dir = config('irfa.lockout.lockout_file_path'); |
51 | 51 | $path = $dir.md5($input); |
52 | 52 | |
53 | - if(is_writable($path)) |
|
53 | + if (is_writable($path)) |
|
54 | 54 | { |
55 | 55 | return true; |
56 | 56 | } |
57 | 57 | return false; |
58 | 58 | } |
59 | 59 | |
60 | - public function testManualLocking($username){ |
|
60 | + public function testManualLocking($username) { |
|
61 | 61 | $input = $username; |
62 | 62 | $dir = config('irfa.lockout.lockout_file_path'); |
63 | 63 | $path = $dir.md5($input); |
64 | 64 | |
65 | - if($this->lock_account($username)) |
|
65 | + if ($this->lock_account($username)) |
|
66 | 66 | { |
67 | 67 | return true; |
68 | 68 | } |
69 | 69 | return false; |
70 | 70 | } |
71 | - public function testUnlocking($username){ |
|
71 | + public function testUnlocking($username) { |
|
72 | 72 | $input = $username; |
73 | 73 | $dir = config('irfa.lockout.lockout_file_path'); |
74 | 74 | $path = $dir.md5($input); |
75 | - $unlock = $this->test_unlock_account($username); |
|
76 | - if($unlock) |
|
75 | + $unlock = $this->test_unlock_account($username); |
|
76 | + if ($unlock) |
|
77 | 77 | { |
78 | 78 | return true; |
79 | 79 | } |
80 | 80 | return false; |
81 | 81 | } |
82 | - public function testLockLogin($username){ |
|
82 | + public function testLockLogin($username) { |
|
83 | 83 | $input = $username; |
84 | 84 | $dir = config('irfa.lockout.lockout_file_path'); |
85 | 85 | $path = $dir.md5($input); |
86 | - $unlock = $this->lockLogin($username); |
|
87 | - if($unlock) |
|
86 | + $unlock = $this->lockLogin($username); |
|
87 | + if ($unlock) |
|
88 | 88 | { |
89 | 89 | return true; |
90 | 90 | } |
91 | 91 | return false; |
92 | 92 | } |
93 | 93 | //////Config |
94 | - private function confLoginAttemps(){ |
|
95 | - if(is_numeric(config('irfa.lockout.login_attemps'))){ |
|
94 | + private function confLoginAttemps() { |
|
95 | + if (is_numeric(config('irfa.lockout.login_attemps'))) { |
|
96 | 96 | $this->ret['login_attemps'] = '<fg=green>OK'; |
97 | - } else{ |
|
97 | + } else { |
|
98 | 98 | |
99 | - $this->ret['err'] +=1; |
|
100 | - $this->ret['login_attemps'] ='<fg=yellow>Must be a number'; |
|
99 | + $this->ret['err'] += 1; |
|
100 | + $this->ret['login_attemps'] = '<fg=yellow>Must be a number'; |
|
101 | 101 | } |
102 | 102 | } |
103 | 103 | |
104 | - private function confLogging(){ |
|
105 | - if(is_bool(config('irfa.lockout.logging'))){ |
|
104 | + private function confLogging() { |
|
105 | + if (is_bool(config('irfa.lockout.logging'))) { |
|
106 | 106 | $this->ret['logging'] = '<fg=green>OK'; |
107 | - } else{ |
|
107 | + } else { |
|
108 | 108 | |
109 | - $this->ret['err'] +=1; |
|
109 | + $this->ret['err'] += 1; |
|
110 | 110 | $this->ret['logging'] = '<fg=yellow>Must be a Boolean'; |
111 | 111 | } |
112 | 112 | } |
113 | - private function confInput(){ |
|
113 | + private function confInput() { |
|
114 | 114 | |
115 | - if(is_string(config('irfa.lockout.input_name'))){ |
|
115 | + if (is_string(config('irfa.lockout.input_name'))) { |
|
116 | 116 | $this->ret['input_name'] = '<fg=green>OK'; |
117 | - } else{ |
|
117 | + } else { |
|
118 | 118 | |
119 | - $this->ret['err'] +=1; |
|
119 | + $this->ret['err'] += 1; |
|
120 | 120 | $this->ret['input_name'] = '<fg=yellow>Must be a String'; |
121 | 121 | } |
122 | 122 | } |
123 | - private function confFilePath(){ |
|
123 | + private function confFilePath() { |
|
124 | 124 | |
125 | 125 | |
126 | - if(is_writable(config('irfa.lockout.lockout_file_path'))){ |
|
126 | + if (is_writable(config('irfa.lockout.lockout_file_path'))) { |
|
127 | 127 | $this->ret['lockout_file_path'] = '<fg=green>OK'; |
128 | - } else{ |
|
128 | + } else { |
|
129 | 129 | $this->ret['lockout_file_path'] = '<fg=yellow>Write Permission Denied in '.config('irfa.lockout.lockout_file_path'); |
130 | 130 | } |
131 | 131 | } |
132 | - private function confRedirectUrl(){ |
|
133 | - if(!empty(config('irfa.lockout.redirect_url'))){ |
|
132 | + private function confRedirectUrl() { |
|
133 | + if (!empty(config('irfa.lockout.redirect_url'))) { |
|
134 | 134 | $this->ret['redirect_url'] = '<fg=green>OK'; |
135 | - } else{ |
|
135 | + } else { |
|
136 | 136 | |
137 | - $this->ret['err'] +=1; |
|
137 | + $this->ret['err'] += 1; |
|
138 | 138 | $this->ret['redirect_url'] = '<fg=yellow>Must be provided'; |
139 | 139 | } |
140 | 140 | } |
141 | - private function confProtectActionPath(){ |
|
142 | - if(is_array(config('irfa.lockout.protected_action_path'))){ |
|
141 | + private function confProtectActionPath() { |
|
142 | + if (is_array(config('irfa.lockout.protected_action_path'))) { |
|
143 | 143 | $this->ret['protected_action_path'] = '<fg=green>OK'; |
144 | - } else{ |
|
144 | + } else { |
|
145 | 145 | |
146 | - $this->ret['err'] +=1; |
|
146 | + $this->ret['err'] += 1; |
|
147 | 147 | $this->ret['protected_action_path'] = '<fg=yellow>Must be array'; |
148 | 148 | } |
149 | 149 | |
150 | 150 | } |
151 | - private function confProtectMiddleware(){ |
|
152 | - if(is_array(config('irfa.lockout.protected_middleware_group'))){ |
|
153 | - if(!empty(config('irfa.lockout.protected_middleware_group'))){ |
|
151 | + private function confProtectMiddleware() { |
|
152 | + if (is_array(config('irfa.lockout.protected_middleware_group'))) { |
|
153 | + if (!empty(config('irfa.lockout.protected_middleware_group'))) { |
|
154 | 154 | $this->ret['protected_middleware_group'] = '<fg=green>OK'; |
155 | - } else{ |
|
156 | - $this->ret['err'] +=1; |
|
155 | + } else { |
|
156 | + $this->ret['err'] += 1; |
|
157 | 157 | $this->ret['protected_middleware_group'] = '<fg=yellow>Must be provided'; |
158 | 158 | } |
159 | - } else{ |
|
159 | + } else { |
|
160 | 160 | |
161 | - $this->ret['err'] +=1; |
|
161 | + $this->ret['err'] += 1; |
|
162 | 162 | $this->ret['protected_middleware_group'] = '<fg=yellow>Must be array'; |
163 | 163 | } |
164 | 164 | |
165 | 165 | } |
166 | - private function confMessage(){ |
|
167 | - if(is_string(config('irfa.lockout.message_name'))){ |
|
166 | + private function confMessage() { |
|
167 | + if (is_string(config('irfa.lockout.message_name'))) { |
|
168 | 168 | $this->ret['message_name'] = '<fg=green>OK'; |
169 | - } else{ |
|
169 | + } else { |
|
170 | 170 | |
171 | - $this->ret['err'] +=1; |
|
171 | + $this->ret['err'] += 1; |
|
172 | 172 | $this->ret['message_name'] = '<fg=yellow>Must be a String'; |
173 | 173 | } |
174 | 174 |