def getpass(prompt=None, secondPrompt=None): """Prompt the user for a password.""" if prompt is None: prompt = ('Enter password: '******'Re-enter password: '******'' secondPassword = '******' # Note that this should be different than password. assert prompt if not prompt[-1].isspace(): prompt += ' ' while True: if useBold: prompt = ansi.BOLD + prompt + ansi.RESET secondPrompt = ansi.BOLD + secondPrompt + ansi.RESET password = getPass(prompt) secondPassword = getPass(secondPrompt) if password != secondPassword: output(('Passwords don\'t match.')) else: break print('') return password # vim:set shiftwidth=4 softtabstop=4 expandtab textwidth=79:
def getpass(prompt='Enter password: '******'Re-enter password: '******'' secondPassword = '******' # Note that this should be different than password. assert prompt if not prompt[-1].isspace(): prompt += ' ' while True: if useBold: prompt += ansi.RESET sys.stdout.write(ansi.BOLD) password = getPass(prompt) secondPassword = getPass(secondPrompt) if password != secondPassword: output('Passwords don\'t match.') else: break return password
def getpass(prompt=None, secondPrompt=None): """Prompt the user for a password.""" if prompt is None: prompt = _("Enter password: "******"Re-enter password: "******"" secondPassword = "******" # Note that this should be different than password. assert prompt if not prompt[-1].isspace(): prompt += " " while True: if useBold: prompt += ansi.RESET sys.stdout.write(ansi.BOLD) password = getPass(prompt) secondPassword = getPass(secondPrompt) if password != secondPassword: output(_("Passwords don't match.")) else: break return password
def getpass(prompt=None, secondPrompt=None): """Prompt the user for a password.""" if prompt is None: prompt = _('Enter password: '******'Re-enter password: '******'' secondPassword = '******' # Note that this should be different than password. assert prompt if not prompt[-1].isspace(): prompt += ' ' while True: if useBold: prompt = ansi.BOLD + prompt + ansi.RESET secondPrompt = ansi.BOLD + secondPrompt + ansi.RESET password = getPass(prompt) secondPassword = getPass(secondPrompt) if password != secondPassword: output(_('Passwords don\'t match.')) else: break print return password