Passed
Push — master ( 86ad47...367093 )
by IRFA
03:54
created
src/Console/Commands/LockInfoPackage.php 1 patch
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -56,8 +56,8 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
     }
Please login to merge, or discard this patch.
src/Console/Commands/CheckLockedCommands.php 1 patch
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -45,13 +45,13 @@
 block discarded – undo
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.');
Please login to merge, or discard this patch.
src/Func/Lockout.php 1 patch
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -16,9 +16,9 @@
 block discarded – undo
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
     }
Please login to merge, or discard this patch.
src/Console/Commands/TestingCommands.php 1 patch
Indentation   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -43,9 +43,9 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
   
Please login to merge, or discard this patch.
src/Func/Testing.php 1 patch
Indentation   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 
Please login to merge, or discard this patch.
src/Middleware/ApiLockAccount.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@
 block discarded – undo
21 21
     public function handle($request, Closure $next)
22 22
     {
23 23
         if($this->exceptAccount()){
24
-             return $next($request);
24
+                return $next($request);
25 25
         }
26 26
         
27 27
         if ($request->method() == "POST") {
Please login to merge, or discard this patch.
src/Middleware/LockAccount.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@
 block discarded – undo
23 23
     public function handle($request, Closure $next)
24 24
     {
25 25
         if($this->exceptAccount()){
26
-             return $next($request);
26
+                return $next($request);
27 27
         } else{
28 28
         if ($request->method() == "POST") {
29 29
             if (in_array($request->path(), config('irfa.lockout.protected_action_path'))) {
Please login to merge, or discard this patch.
src/Initializing/Variable.php 1 patch
Indentation   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -5,35 +5,35 @@
 block discarded – undo
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 $except_enabled;
14
-	    protected $except_accounts;
15
-	    protected $permission_code;
8
+        protected $ip;
9
+        protected $input=null;
10
+        protected $dir;
11
+        protected $path;
12
+        protected $attemps;
13
+        protected $except_enabled;
14
+        protected $except_accounts;
15
+        protected $permission_code;
16 16
 
17
-	    /**
18
-		 * Initializing variable.
19
-		 *
20
-		 * @return void
21
-		 */
22
-		protected function initVar(){
23
-			// if(!empty(config('irfa.lockout'))){
24
-		        $this->ip = Request::ip();
25
-		        $this->input = Request::input(config('irfa.lockout.input_name'));
26
-		        $this->dir = config('irfa.lockout.lockout_file_path');
27
-		        $this->attemps = config('irfa.lockout.login_attemps');
28
-		        $this->except_enabled = config('irfa.lockout.enable_except_account');
29
-		        $this->except_accounts = config('irfa.lockout.except_account');
30
-		        $this->path = $this->dir.md5($this->input);
31
-		    // }
32
-    	}
17
+        /**
18
+         * Initializing variable.
19
+         *
20
+         * @return void
21
+         */
22
+        protected function initVar(){
23
+            // if(!empty(config('irfa.lockout'))){
24
+                $this->ip = Request::ip();
25
+                $this->input = Request::input(config('irfa.lockout.input_name'));
26
+                $this->dir = config('irfa.lockout.lockout_file_path');
27
+                $this->attemps = config('irfa.lockout.login_attemps');
28
+                $this->except_enabled = config('irfa.lockout.enable_except_account');
29
+                $this->except_accounts = config('irfa.lockout.except_account');
30
+                $this->path = $this->dir.md5($this->input);
31
+            // }
32
+        }
33 33
 
34
-    	protected function setPath($username){
35
-    		$this->path = $this->dir.md5($username);
36
-    		$this->input = $username;
37
-    	}
34
+        protected function setPath($username){
35
+            $this->path = $this->dir.md5($username);
36
+            $this->input = $username;
37
+        }
38 38
 	
39
-	}
40 39
\ No newline at end of file
40
+    }
41 41
\ No newline at end of file
Please login to merge, or discard this patch.
src/Func/Core.php 1 patch
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -17,13 +17,13 @@  discard block
 block discarded – undo
17 17
     protected function exceptAccount(){
18 18
         $this->initVar();
19 19
         if($this->except_enabled){
20
-          if(in_array($this->input, $this->except_accounts)){
20
+            if(in_array($this->input, $this->except_accounts)){
21 21
             return true;
22
-          } else{
22
+            } else{
23 23
             return false;
24
-          }
24
+            }
25 25
         } else{
26
-         return false;
26
+            return false;
27 27
         }
28 28
     }
29 29
 
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
      * @return void
75 75
      */
76 76
     protected function eventCleanLockoutAccount() {
77
-       $this->initVar();
77
+        $this->initVar();
78 78
         $this->unlock_account($this->input);
79 79
           
80 80
     }
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
      * @return boolean
134 134
      */
135 135
     protected function lockLogin($username = null){
136
-         $this->initVar();
136
+            $this->initVar();
137 137
         if(php_sapi_name() == "cli" AND $username != null){
138 138
             $this->setPath($username);
139 139
         }
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
161 161
          * @return boolean
162 162
          */
163 163
     private function checkIp($ip_list,$ip){
164
-       $this->initVar();
164
+        $this->initVar();
165 165
         if(collect($ip_list)->contains($ip)){
166 166
             return true;
167 167
         } else{
@@ -176,7 +176,7 @@  discard block
 block discarded – undo
176 176
          * @return boolean
177 177
          */
178 178
     public function clear_all(){
179
-       $this->initVar();
179
+        $this->initVar();
180 180
         $file = new Filesystem();
181 181
         if($file->cleanDirectory($this->path)){
182 182
         return true;
Please login to merge, or discard this patch.