mirror of
https://github.com/Mikaela/Limnoria.git
synced 2025-01-11 20:52:42 +01:00
Let's make the second prompt configurable too.
This commit is contained in:
parent
b888fa49be
commit
12f9d6ed11
@ -114,10 +114,10 @@ def yn(prompt, default=None):
|
|||||||
else:
|
else:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def getpass(prompt='Enter password: '):
|
def getpass(prompt='Enter password: ', secondPrompt='Re-enter password: '):
|
||||||
"""Prompt the user for a password."""
|
"""Prompt the user for a password."""
|
||||||
password = ''
|
password = ''
|
||||||
password2 = ' '
|
secondPassword = ' ' # Note that this should be different than password.
|
||||||
assert prompt
|
assert prompt
|
||||||
if not prompt[-1].isspace():
|
if not prompt[-1].isspace():
|
||||||
prompt += ' '
|
prompt += ' '
|
||||||
@ -125,10 +125,10 @@ def getpass(prompt='Enter password: '):
|
|||||||
if useBold:
|
if useBold:
|
||||||
sys.stdout.write(ansi.BOLD)
|
sys.stdout.write(ansi.BOLD)
|
||||||
password = getPass(prompt)
|
password = getPass(prompt)
|
||||||
password2 = getPass('Re-enter password: ')
|
secondPassword = getPass(secondPrompt)
|
||||||
if useBold:
|
if useBold:
|
||||||
print ansi.RESET
|
print ansi.RESET
|
||||||
if password != password2:
|
if password != secondPassword:
|
||||||
output('Passwords don\'t match.')
|
output('Passwords don\'t match.')
|
||||||
else:
|
else:
|
||||||
break
|
break
|
||||||
|
Loading…
Reference in New Issue
Block a user