Skip to content

Commit

Permalink
Merge branch 'master' of github.com:irfaardy/lockout-account
Browse files Browse the repository at this point in the history
  • Loading branch information
irfaardy committed Jul 5, 2020
2 parents a06f40e + 78acba2 commit 86bd241
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 36 deletions.
15 changes: 6 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@


# 🔒 **Json Lockout Account for Laravel**
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/irfaardy/lockout-account/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/irfaardy/lockout-account/?branch=master) [![Build Status](https://scrutinizer-ci.com/g/irfaardy/lockout-account/badges/build.png?b=master)](https://scrutinizer-ci.com/g/irfaardy/lockout-account/build-status/master) [![Support me](https://img.shields.io/badge/Support-Buy%20me%20a%20coffee-yellow.svg?style=flat-square)](https://www.buymeacoffee.com/OBaAofN) [![Latest Stable Version](https://poser.pugx.org/irfa/lockout/v)](//packagist.org/packages/irfa/lockout)
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/irfaardy/lockout-account/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/irfaardy/lockout-account/?branch=master) [![Build Status](https://scrutinizer-ci.com/g/irfaardy/lockout-account/badges/build.png?b=master)](https://scrutinizer-ci.com/g/irfaardy/lockout-account/build-status/master) [![Support me](https://img.shields.io/badge/Support-Buy%20me%20a%20coffee-yellow.svg?style=flat-square)](https://www.buymeacoffee.com/OBaAofN) [![Latest Stable Version](https://flat.badgen.net/packagist/v/irfa/lockout/latest?label=Packagist)](//packagist.org/packages/irfa/lockout)


This package is useful for locking an account if someone tries to log into your account, this package can be implemented into the admin dashboard login, information system, cloud, etc.
Expand All @@ -13,7 +12,7 @@ This package is useful for locking an account if someone tries to log into your
composer require irfa/lockout
```

>You can get Composer [ here]( https://getcomposer.org/download/)
>You can get Composer <a href="https://getcomposer.org/download/" target="_blank">here</a>
***
<h2>🛠️ Laravel Setup </h2>
Expand Down Expand Up @@ -173,16 +172,14 @@ class UserManage {

**Other Commands**

**show package info**

```php
php artisan lockout:info
php artisan lockout:diagnose
php artisan lockout:info //Show more info this package
php artisan lockout:diagnose //diagnose and testing lockout account
```
-------

<h3>Change Messages</h3>
You can change message in ``resources/lang/{language}/lockoutMessage.php``
You can change message in `resources/lang/{language}/lockoutMessage.php`

<h3>Show Message</h3>

Expand Down Expand Up @@ -227,7 +224,7 @@ composer remove irfa/lockout

1. Fork it (<https://github.com/irfaardy/lockout-account/fork>)
3. Commit your changes (`git commit -m 'Add some Feature'`)
4. Push to the branch (`git push origin master`)
4. Push to the branch (`git push origin version`)
5. Create a new Pull Request
***

Expand Down
54 changes: 27 additions & 27 deletions src/Console/Commands/TestingCommands.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@

class TestingCommands extends Command
{
private $error=0;
private $success=0;
private $error = 0;
private $success = 0;
/**
* The name and signature of the console command.
*
Expand Down Expand Up @@ -43,9 +43,9 @@ public function __construct()
*/
public function handle()
{
$curTime = microtime(true);
$curTime = microtime(true);
$domain = 'locktest-'.md5(strtolower(config("app.name"))).'@'.strtolower(config("app.name")).".com";
$this->line('<fg=default>--------------------------------------------');
$this->line('<fg=default>--------------------------------------------');
$this->testConfigurations();
$this->line('<fg=default>Testing Mail : <fg=cyan>'.$domain);
$this->testWrite($domain);
Expand All @@ -60,54 +60,54 @@ public function handle()
}
private function testWrite($domain){
$test = new Testing();
if( $test->testWriteEventFailedLogin($domain) AND $test->testWritable($domain)){
$this->line('<fg=default>Auto Lock : <fg=green>OK');
if( $test->testWriteEventFailedLogin($domain) AND $test->testWritable($domain)){
$this->line('<fg=default>Auto Lock : <fg=green>OK');
} elseif(!$test->testWritable($domain)){
$this->success += 1;
$this->line('<fg=default>Auto Lock : <fg=yellow>Warning (Permission denied)');
} else{
$this->error += 1;
$this->line('<fg=default>Auto Lock : <fg=red>Failed');
$this->line('<fg=default>Auto Lock : <fg=red>Failed');
}
}
private function testManualLock($domain){
$test = new Testing();
if( $test->testManualLocking($domain)){
if( $test->testManualLocking($domain)){
$this->success += 1;
$this->line('<fg=default>Manual Lock : <fg=green>OK');
$this->line('<fg=default>Manual Lock : <fg=green>OK');
} else{
$this->error += 1;
$this->line('<fg=default>Manual Lock : <fg=red>Failed');
$this->line('<fg=default>Manual Lock : <fg=red>Failed');
}
}
private function testUnlock($domain){
$test = new Testing();
if( $test->testUnlocking($domain)){
$this->success += 1;
$this->line('<fg=default>Unlock Account : <fg=green>OK');
if( $test->testUnlocking($domain)){
$this->success += 1;
$this->line('<fg=default>Unlock Account : <fg=green>OK');
} else{
$this->error += 1;
$this->line('<fg=default>Unlock Account : <fg=red>Failed');
$this->error += 1;
$this->line('<fg=default>Unlock Account : <fg=red>Failed');
}
}

private function testLocked($domain){
$test = new Testing();
if( $test->testLockLogin($domain)){
$this->success += 1;
$this->line('<fg=default>Try Login with locked account : <fg=green>Account is Locked');
if( $test->testLockLogin($domain)){
$this->success += 1;
$this->line('<fg=default>Try Login with locked account : <fg=green>Account is Locked');
} else{
$this->error += 1;
$this->line('<fg=default>Try Login with locked account : <fg=red>Account logged in');
$this->error += 1;
$this->line('<fg=default>Try Login with locked account : <fg=red>Account logged in');
}
}

private function testConfigurations(){
$test = new Testing();
$res = $test->testConfig();
$test = new Testing();
$res = $test->testConfig();

$table = new Table($this->output);
$this->line('<fg=cyan>Testing Config:');
$table = new Table($this->output);
$this->line('<fg=cyan>Testing Config:');
$table->setRows([
['<fg=default>login_attemps',isset($res['login_attemps']) ? $res['login_attemps']:"<fg=red>Not Found"],
['<fg=default>logging',isset($res['logging']) ? $res['logging']:"<fg=red>Not Found"],
Expand All @@ -132,12 +132,12 @@ private function errorCheck($res){
}

private function configCheck($res){
if($res['err'] > 0){
if($res['err'] > 0){
$this->line('<fg=red>Config invalid, testing is canceled.');
$this->line('<fg=default>--------------------------------------------');
$this->line('<fg=default>Tested at: '.date('Y-m-d H:m:s',time()));
exit();
}
}
}

private function configExists($res){
Expand All @@ -147,7 +147,7 @@ private function configExists($res){
$this->line('<fg=default>--------------------------------------------');
$this->line('<fg=default>Tested at: '.date('Y-m-d H:m:s',time()));
exit();
}
}
}


Expand Down

0 comments on commit 86bd241

Please sign in to comment.