1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Irfa\Lockout\Console\Commands; |
4
|
|
|
|
5
|
|
|
use Illuminate\Console\Command; |
6
|
|
|
use Irfa\Lockout\Func\Testing; |
7
|
|
|
use Symfony\Component\Console\Helper\Table; |
8
|
|
|
use URL; |
9
|
|
|
use Str; |
|
|
|
|
10
|
|
|
|
11
|
|
|
class TestingCommands extends Command |
12
|
|
|
{ |
13
|
|
|
private $error=0; |
14
|
|
|
private $success=0; |
15
|
|
|
/** |
16
|
|
|
* The name and signature of the console command. |
17
|
|
|
* |
18
|
|
|
* @var string |
19
|
|
|
*/ |
20
|
|
|
protected $signature = 'lockout:test'; |
21
|
|
|
|
22
|
|
|
/** |
23
|
|
|
* The console command description. |
24
|
|
|
* |
25
|
|
|
* @var string |
26
|
|
|
*/ |
27
|
|
|
protected $description = 'Lock Account'; |
28
|
|
|
|
29
|
|
|
/** |
30
|
|
|
* Create a new command instance. |
31
|
|
|
* |
32
|
|
|
* @return void |
33
|
|
|
*/ |
34
|
|
|
public function __construct() |
35
|
|
|
{ |
36
|
|
|
parent::__construct(); |
37
|
|
|
} |
38
|
|
|
|
39
|
|
|
/** |
40
|
|
|
* Execute the console command. |
41
|
|
|
* |
42
|
|
|
* @return mixed |
43
|
|
|
*/ |
44
|
|
|
public function handle() |
45
|
|
|
{ |
46
|
|
|
$domain = strtolower(config("app.name")).".com"; |
47
|
|
|
$this->line('<fg=default>--------------------------------------------'); |
48
|
|
|
$this->testWrite($domain); |
49
|
|
|
sleep(1); |
50
|
|
|
$this->testManualLock($domain); |
51
|
|
|
sleep(1); |
52
|
|
|
$this->testLocked($domain); |
53
|
|
|
sleep(1); |
54
|
|
|
$this->testUnlock($domain); |
55
|
|
|
|
56
|
|
|
} |
57
|
|
|
private function testWrite($domain){ |
58
|
|
|
$test = new Testing(); |
59
|
|
|
if( $test->testWriteEventFailedLogin('lock-test@'.$domain) AND $test->testWritable('lock-test@'.$domain)){ |
60
|
|
|
$this->line('<fg=default>Auto Lock : <fg=green>OK'); |
61
|
|
|
} elseif(!$test->testWritable('lock-test@'.$domain)){ |
62
|
|
|
$this->success += 1; |
63
|
|
|
$this->line('<fg=default>Auto Lock : <fg=yellow>Warning (Permission denied)'); |
64
|
|
|
} else{ |
65
|
|
|
$this->error += 1; |
66
|
|
|
$this->line('<fg=default>Auto Lock : <fg=red>Failed'); |
67
|
|
|
} |
68
|
|
|
} |
69
|
|
|
private function testManualLock($domain){ |
70
|
|
|
$test = new Testing(); |
71
|
|
|
if( $test->testManualLocking('lock-test@'.$domain)){ |
72
|
|
|
$this->success += 1; |
73
|
|
|
$this->line('<fg=default>Manual Lock : <fg=green>OK'); |
74
|
|
|
} else{ |
75
|
|
|
$this->error += 1; |
76
|
|
|
$this->line('<fg=default>Manual Lock : <fg=red>Failed'); |
77
|
|
|
} |
78
|
|
|
} |
79
|
|
|
private function testUnlock($domain){ |
80
|
|
|
$test = new Testing(); |
81
|
|
|
if( $test->testUnlocking('lock-test@'.$domain)){ |
82
|
|
|
$this->success += 1; |
83
|
|
|
$this->line('<fg=default>Unlock Account : <fg=green>OK'); |
84
|
|
|
} else{ |
85
|
|
|
$this->error += 1; |
86
|
|
|
$this->line('<fg=default>Unlock Account : <fg=red>Failed'); |
87
|
|
|
} |
88
|
|
|
} |
89
|
|
|
|
90
|
|
|
private function testLocked($domain){ |
91
|
|
|
$test = new Testing(); |
92
|
|
|
if( $test->testLockLogin('lock-test@'.$domain)){ |
93
|
|
|
$this->success += 1; |
94
|
|
|
$this->line('<fg=default>Try Login with locked account : <fg=green>Account is Locked'); |
95
|
|
|
} else{ |
96
|
|
|
$this->error += 1; |
97
|
|
|
$this->line('<fg=default>Try Login with locked account : <fg=red>Account logged in'); |
98
|
|
|
} |
99
|
|
|
} |
100
|
|
|
|
101
|
|
|
} |
102
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths