Skip to content

Commit

Permalink
Don't expose password (#11)
Browse files Browse the repository at this point in the history
* Don't expose password

Utilize the `secret` method in order to hide the password input.

* Fixed according integrity check
  • Loading branch information
EmilMoe authored Mar 26, 2020
1 parent 88ac3e9 commit 3406f61
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/Commands/CreateUser.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public function handle()
$password = str_random(8);
$this->info('*The randomly created password is: '.$password);
} else {
$password = $this->validate_ask('Enter user password', ['password' => config('createuser.validation_rules.password')]);
$password = $this->validate_ask('Enter user password', ['password' => config('createuser.validation_rules.password')], true);
}

$model = config('createuser.model');
Expand All @@ -57,9 +57,13 @@ public function handle()
}
}

public function validate_ask($question, $rules)
public function validate_ask($question, $rules, $isSecret = false)
{
$value = $this->ask($question);
if ($isSecret) {
$value = $this->secret($question);
} else {
$value = $this->ask($question);
}

$validate = $this->validateInput($rules, $value);

Expand Down

0 comments on commit 3406f61

Please sign in to comment.