Skip to content

Commit

Permalink
fixup! Command: Add app password generation
Browse files Browse the repository at this point in the history
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
  • Loading branch information
rullzer committed Dec 23, 2020
1 parent eb361b6 commit eeee12a
Showing 1 changed file with 2 additions and 15 deletions.
17 changes: 2 additions & 15 deletions core/Command/User/AddAppPassword.php
Original file line number Diff line number Diff line change
Expand Up @@ -133,21 +133,8 @@ protected function execute(InputInterface $input, OutputInterface $output): int
IToken::DO_NOT_REMEMBER
);

try {
$code = $this->random->generate(128, ISecureRandom::CHAR_UPPER . ISecureRandom::CHAR_LOWER . ISecureRandom::CHAR_DIGITS);
$accessToken = new AccessToken();
$accessToken->setClientId(0);
$accessToken->setEncryptedToken($this->crypto->encrypt($token, $code));
$accessToken->setHashedCode(hash('sha512', $code));
$accessToken->setTokenId($generatedToken->getId());
$this->accessTokenMapper->insert($accessToken);

$output->writeln('app password:');
$output->writeln($token);
} catch (\Exception $e) {
$output->writeln('<error>' . $e->getMessage() . '</error>');
return 1;
}
$output->writeln('app password:');
$output->writeln($token);

return 0;
}
Expand Down

0 comments on commit eeee12a

Please sign in to comment.