Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow setting password explicitly in console domjudge:reset-user-password #2741

Merged
merged 1 commit into from
Oct 13, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion webapp/src/Command/ResetUserPasswordCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@ protected function configure(): void
'username',
InputArgument::REQUIRED,
'The username of the user to reset the password of'
)
->addArgument(
'password',
InputArgument::OPTIONAL,
'The new password; if not provided a random password is generated'
);
}

Expand All @@ -50,7 +55,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
return Command::FAILURE;
}

$password = Utils::generatePassword();
$password = $input->getArgument('password') ?? Utils::generatePassword();

$user->setPassword(
$this->passwordHasher->hashPassword($user, $password)
Expand Down
Loading