mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-08-29 03:59:21 +03:00
Don't input password in command, ask in prompt #1552
This commit is contained in:
parent
372e4bc1c0
commit
b7a11d42de
1 changed files with 10 additions and 4 deletions
|
|
@ -37,15 +37,12 @@ class Settings extends Base
|
|||
)
|
||||
->addArgument(
|
||||
'pass',
|
||||
InputArgument::REQUIRED,
|
||||
InputArgument::OPTIONAL,
|
||||
'The login passphrase'
|
||||
)
|
||||
;
|
||||
}
|
||||
|
||||
protected function checkInput(InputInterface $input) {
|
||||
}
|
||||
|
||||
protected function execute(InputInterface $input, OutputInterface $output): int {
|
||||
$uid = $input->getArgument('uid');
|
||||
if (!$this->userManager->userExists($uid)) {
|
||||
|
|
@ -57,6 +54,15 @@ class Settings extends Base
|
|||
$this->config->setUserValue($uid, 'snappymail', 'snappymail-email', $sEmail);
|
||||
|
||||
$sPass = $input->getArgument('pass');
|
||||
if (empty($sPass)) {
|
||||
// Prompt on command line for value
|
||||
if (\is_callable('readline')) {
|
||||
$sPass = \readline("password: ");
|
||||
} else {
|
||||
echo "password: ";
|
||||
$sPass = \stream_get_line(STDIN, 1024, PHP_EOL);
|
||||
}
|
||||
}
|
||||
$sPass = ($sEmail && $sPass) ? SnappyMailHelper::encodePassword($sPass, \md5($sEmail)) : '';
|
||||
$this->config->setUserValue($uid, 'snappymail', 'passphrase', $sPass);
|
||||
return 0;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue