Reverting .strip() logic and moving the check into the get_password() function.

This commit is contained in:
Anton Hvornum 2021-03-29 10:20:35 +02:00
parent 5e3a152364
commit 36dfa2e1c4
No known key found for this signature in database
GPG Key ID: F1234C5BA67C59DF
2 changed files with 5 additions and 1 deletions

View File

@ -24,6 +24,10 @@ def get_password(prompt="Enter a password: "):
if passwd != passwd_verification:
log(' * Passwords did not match * ', bg='black', fg='red')
continue
if len(passwd.strip()) <= 0:
break
return passwd
return None

View File

@ -139,7 +139,7 @@ def ask_user_questions():
# Get disk encryption password (or skip if blank)
if not archinstall.arguments.get('!encryption-password', None):
if (passwd := archinstall.get_password(prompt='Enter disk encryption password (leave blank for no encryption): ')).strip():
if (passwd := archinstall.get_password(prompt='Enter disk encryption password (leave blank for no encryption): ')):
archinstall.arguments['!encryption-password'] = passwd
archinstall.arguments['harddrive'].encryption_password = archinstall.arguments['!encryption-password']