Fix incorrect behavior for empty sudo username

This commit is contained in:
SecondThundeR 2021-04-05 23:13:27 +03:00 committed by Dylan Taylor
parent b6e9f11669
commit 23fc3ab2f2
1 changed files with 2 additions and 2 deletions

View File

@ -61,8 +61,6 @@ def ask_for_superuser_account(prompt='Create a required super-user with sudo pri
while 1:
new_user = input(prompt).strip(' ')
if not check_for_correct_username(new_user):
continue
if not new_user and forced:
# TODO: make this text more generic?
# It's only used to create the first sudo user when root is disabled in guided.py
@ -70,6 +68,8 @@ def ask_for_superuser_account(prompt='Create a required super-user with sudo pri
continue
elif not new_user and not forced:
raise UserError("No superuser was created.")
elif not check_for_correct_username(new_user):
continue
password = get_password(prompt=f'Password for user {new_user}: ')
return {new_user: {"!password" : password}}