Passed
Push — master ( 806009...dd1a63 )
by IRFA
03:41
created
src/Func/Core.php 1 patch
Indentation   +78 added lines, -78 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
     protected function eventFailedLogin($username=null){
30 30
         
31 31
         if($username !== null){
32
-          $this->setPath($username);
32
+            $this->setPath($username);
33 33
         }
34 34
         if(!File::exists($this->dir)){
35 35
                 File::makeDirectory($this->dir, 0755, true);
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
             $content = ['username' => $this->input,'attemps' => $login_fail,'ip' => isset($ip_list)?$ip_list:[$this->ip],'last_attemps' => date("Y-m-d H:i:s",time())];
56 56
             File::put($this->path,json_encode($content));
57 57
             if(File::exists($this->path)){
58
-              chmod($this->path,0755);
58
+                chmod($this->path,0755);
59 59
             }
60 60
           
61 61
     }
@@ -84,31 +84,31 @@  discard block
 block discarded – undo
84 84
             }
85 85
     }
86 86
 
87
-     /**
88
-       * Check if user is locked
89
-       *
90
-       * @param  string  $username
91
-       * @return boolean
92
-     */
87
+        /**
88
+         * Check if user is locked
89
+         *
90
+         * @param  string  $username
91
+         * @return boolean
92
+         */
93 93
     protected function is_locked($username){
94 94
         $this->setPath($username);
95 95
         if(File::exists($this->path))
96 96
         {
97
-           $get = json_decode(File::get($this->path));
98
-           if($get->attemps > $this->attemps || $get->attemps == "lock"){
99
-              return true;
100
-           } else{
101
-              return false;
102
-           }
97
+            $get = json_decode(File::get($this->path));
98
+            if($get->attemps > $this->attemps || $get->attemps == "lock"){
99
+                return true;
100
+            } else{
101
+                return false;
102
+            }
103 103
         } else{
104 104
             return false;
105 105
         }
106 106
     }
107 107
 
108 108
     /**
109
-       * Show message if failed x attemps
110
-       *
111
-       * @return mixed
109
+     * Show message if failed x attemps
110
+     *
111
+     * @return mixed
112 112
      */
113 113
     protected function showMessage(){
114 114
         if(Session::has(config('irfa.lockout.message_name'))){
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
     protected function lockLogin($username = null){
127 127
         
128 128
         if(php_sapi_name() == "cli" AND $username != null){
129
-          $this->setPath($username);
129
+            $this->setPath($username);
130 130
         }
131 131
 
132 132
         if(File::exists($this->path))
@@ -154,11 +154,11 @@  discard block
 block discarded – undo
154 154
             }
155 155
     }
156 156
 
157
-     /**
158
-     * Check ip locked
159
-     *
160
-     * @return boolean
161
-     */
157
+        /**
158
+         * Check ip locked
159
+         *
160
+         * @return boolean
161
+         */
162 162
     private function checkIp($ip_list,$ip){
163 163
         if(collect($ip_list)->contains($ip)){
164 164
             return true;
@@ -168,11 +168,11 @@  discard block
 block discarded – undo
168 168
 
169 169
     }
170 170
 
171
-     /**
172
-     * Clear all locked account
173
-     *
174
-     * @return boolean
175
-     */
171
+        /**
172
+         * Clear all locked account
173
+         *
174
+         * @return boolean
175
+         */
176 176
     public function clear_all(){
177 177
         $file = new Filesystem();
178 178
         if($file->cleanDirectory($this->path)){
@@ -182,15 +182,15 @@  discard block
 block discarded – undo
182 182
         }
183 183
     }
184 184
 
185
-     /**
186
-     * Unlocking account manually.
187
-     *
188
-     * @param string $username
189
-     * @return mixed
190
-     */
185
+        /**
186
+         * Unlocking account manually.
187
+         *
188
+         * @param string $username
189
+         * @return mixed
190
+         */
191 191
     public function unlock_account($username){
192 192
         $this->setPath($username);
193
-         if(File::exists($this->path)){
193
+            if(File::exists($this->path)){
194 194
             $readf = File::get($this->path);
195 195
                 File::delete($this->path);
196 196
             if(php_sapi_name() == "cli"){
@@ -208,7 +208,7 @@  discard block
 block discarded – undo
208 208
                 return false;
209 209
             }
210 210
         }
211
-      }
211
+        }
212 212
 
213 213
     /**
214 214
      * For Testing
@@ -217,7 +217,7 @@  discard block
 block discarded – undo
217 217
      */
218 218
     public function test_unlock_account($username){
219 219
         $this->setPath($username);
220
-         if(File::exists($this->path)){
220
+            if(File::exists($this->path)){
221 221
             $readf = File::get($this->path);
222 222
                 File::delete($this->path);
223 223
             if(php_sapi_name() == "cli"){
@@ -228,12 +228,12 @@  discard block
 block discarded – undo
228 228
             }
229 229
         } else{
230 230
             if(php_sapi_name() == "cli"){
231
-               return false;
231
+                return false;
232 232
             } else{
233 233
                 return false;
234 234
             }
235 235
         }
236
-      }
236
+        }
237 237
 
238 238
     /**
239 239
      * Check account with details
@@ -242,59 +242,59 @@  discard block
 block discarded – undo
242 242
      * @return mixed
243 243
      */
244 244
     public function check_account($username){
245
-      $this->setPath($username);
246
-       if(File::exists($this->path)){
247
-              $readf = File::get($this->path);
248
-              if(php_sapi_name() == "cli"){
245
+        $this->setPath($username);
246
+        if(File::exists($this->path)){
247
+                $readf = File::get($this->path);
248
+                if(php_sapi_name() == "cli"){
249 249
                 
250
-                  return $readf;
250
+                    return $readf;
251 251
                 
252
-              } else{
253
-                  return $readf;
254
-              }
255
-          } else{
256
-              if(php_sapi_name() == "cli"){
257
-                  echo Lang::get('lockoutMessage.user_lock_404')."\n";
258
-                  exit();
259
-              } else{
260
-                  return false;
261
-              }
262
-          }
252
+                } else{
253
+                    return $readf;
254
+                }
255
+            } else{
256
+                if(php_sapi_name() == "cli"){
257
+                    echo Lang::get('lockoutMessage.user_lock_404')."\n";
258
+                    exit();
259
+                } else{
260
+                    return false;
261
+                }
262
+            }
263 263
         }
264 264
 
265
-     /**
266
-     * Locking account manually
267
-     *
268
-     * @param string $username
269
-     * @return mixed
270
-     */
265
+        /**
266
+         * Locking account manually
267
+         *
268
+         * @param string $username
269
+         * @return mixed
270
+         */
271 271
     public function lock_account($username){
272 272
         $sapi = php_sapi_name() == "cli"?"lock-via-cli":"lock-via-web";
273 273
         $this->setPath($username);
274 274
         try{
275
-          if(!File::exists($this->dir)){
276
-              File::makeDirectory($this->dir, 0755, true);
277
-          }
278
-              $login_fail = "lock";
275
+            if(!File::exists($this->dir)){
276
+                File::makeDirectory($this->dir, 0755, true);
277
+            }
278
+                $login_fail = "lock";
279 279
         
280
-              $content = ['username' => $this->input,'attemps' => $login_fail,'ip' => [$sapi],'last_attemps' => date("Y-m-d H:i:s",time())];
281
-              File::put($this->path,json_encode($content));
282
-              if(File::exists($this->path)){
280
+                $content = ['username' => $this->input,'attemps' => $login_fail,'ip' => [$sapi],'last_attemps' => date("Y-m-d H:i:s",time())];
281
+                File::put($this->path,json_encode($content));
282
+                if(File::exists($this->path)){
283 283
                 chmod($this->path,0755);
284
-              }
285
-              if(php_sapi_name() == "cli"){
284
+                }
285
+                if(php_sapi_name() == "cli"){
286 286
                 return Lang::get('lockoutMessage.user_lock_success')."\n";
287 287
                 
288
-              } else{
289
-              return true;
290
-              }
291
-          } catch(\Exception $e){
292
-              if(php_sapi_name() == "cli"){
288
+                } else{
289
+                return true;
290
+                }
291
+            } catch(\Exception $e){
292
+                if(php_sapi_name() == "cli"){
293 293
                 return "error";
294 294
                 
295
-              } else{
295
+                } else{
296 296
                 return false;
297
-              }
298
-          }
297
+                }
298
+            }
299 299
     }
300 300
 }
301 301
\ No newline at end of file
Please login to merge, or discard this patch.