Validate the password before generating an apptoken

Signed-off-by: Joas Schilling <coding@schilljs.com>
This commit is contained in:
Joas Schilling 2022-03-10 15:28:01 +01:00
parent a6882deebc
commit 50ccf7e2cf
No known key found for this signature in database
GPG key ID: 7076EA9751AACDDA

View file

@ -109,8 +109,10 @@ class AddAppPassword extends Command {
return 1;
}
$output->writeln('<info>The password is not validated so what you provide is what gets recorded in the token</info>');
if (!$this->userManager->checkPassword($user->getUID(), $password)) {
$output->writeln('<error>The provided password is invalid</error>');
return 1;
}
$token = $this->random->generate(72, ISecureRandom::CHAR_UPPER.ISecureRandom::CHAR_LOWER.ISecureRandom::CHAR_DIGITS);
$generatedToken = $this->tokenProvider->generateToken(