Change read_password() logic to better catch improper passwords
Currently read_password does not verify password length. But further down the chain, passwords are checked to make sure they are longer than four characters. If during initial setup, the user enters a password that is shorter than four characters, this will not be caught here, but when the script actually calls management/mailconfig.py to add the user, it will fail without a chance to correct the short password. The setup script will then continue without an inital user being created and this will confuse users.
This commit is contained in:
parent
3d21f2223e
commit
6c64723d7c
|
@ -28,12 +28,16 @@ def mgmt(cmd, data=None, is_json=False):
|
||||||
return resp
|
return resp
|
||||||
|
|
||||||
def read_password():
|
def read_password():
|
||||||
|
while True:
|
||||||
first = getpass.getpass('password: ')
|
first = getpass.getpass('password: ')
|
||||||
|
if len(first) < 4:
|
||||||
|
print('Passwords must be at least four characters.')
|
||||||
|
continue
|
||||||
second = getpass.getpass(' (again): ')
|
second = getpass.getpass(' (again): ')
|
||||||
while first != second:
|
if first != second:
|
||||||
print('Passwords not the same. Try again.')
|
print('Passwords not the same. Try again.')
|
||||||
first = getpass.getpass('password: ')
|
continue
|
||||||
second = getpass.getpass(' (again): ')
|
break
|
||||||
return first
|
return first
|
||||||
|
|
||||||
def setup_key_auth(mgmt_uri):
|
def setup_key_auth(mgmt_uri):
|
||||||
|
|
Loading…
Reference in New Issue