Skip to content

Commit f74e227

Browse files
committed
Allow setting password explicitly in `console domjudge:reset-user-password
This can be useful for example to reset the admin password to what's in `etc/initial_admin_password.secret`.
1 parent 8595592 commit f74e227

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

webapp/src/Command/ResetUserPasswordCommand.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,11 @@ protected function configure(): void
3333
'username',
3434
InputArgument::REQUIRED,
3535
'The username of the user to reset the password of'
36+
)
37+
->addArgument(
38+
'password',
39+
InputArgument::OPTIONAL,
40+
'The new password; if not provided a random password is generated'
3641
);
3742
}
3843

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

53-
$password = Utils::generatePassword();
58+
$password = $input->getArgument('password') ?? Utils::generatePassword();
5459

5560
$user->setPassword(
5661
$this->passwordHasher->hashPassword($user, $password)

0 commit comments

Comments
 (0)