| @@ -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(); | 
| @@ -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 | } |