def get_new_passphrase(desc, passchg=False): w = '{}passphrase for {}'.format(('', 'new ')[bool(passchg)], desc) if opt.passwd_file: pw = ' '.join(get_words_from_file(opt.passwd_file, w)) elif opt.echo_passphrase: pw = ' '.join(get_words_from_user('Enter {}: '.format(w))) else: from mmgen.common import mswin_pw_warning mswin_pw_warning() for i in range(g.passwd_max_tries): pw = ' '.join(get_words_from_user('Enter {}: '.format(w))) pw2 = ' '.join(get_words_from_user('Repeat passphrase: ')) dmsg('Passphrases: [{}] [{}]'.format(pw, pw2)) if pw == pw2: vmsg('Passphrases match') break else: msg('Passphrases do not match. Try again.') else: die( 2, 'User failed to duplicate passphrase in {} attempts'.format( g.passwd_max_tries)) if pw == '': qmsg('WARNING: Empty passphrase') return pw
def get_mmgen_passphrase(desc,passchg=False): prompt ='Enter {}passphrase for {}: '.format(('','old ')[bool(passchg)],desc) if opt.passwd_file: pwfile_reuse_warning() return ' '.join(get_words_from_file(opt.passwd_file,'passphrase')) else: from mmgen.common import mswin_pw_warning mswin_pw_warning() return ' '.join(get_words_from_user(prompt))
def get_new_passphrase(desc,passchg=False): w = '{}passphrase for {}'.format(('','new ')[bool(passchg)], desc) if opt.passwd_file: pw = ' '.join(get_words_from_file(opt.passwd_file,w)) elif opt.echo_passphrase: pw = ' '.join(get_words_from_user('Enter {}: '.format(w))) else: from mmgen.common import mswin_pw_warning mswin_pw_warning() for i in range(g.passwd_max_tries): pw = ' '.join(get_words_from_user('Enter {}: '.format(w))) pw2 = ' '.join(get_words_from_user('Repeat passphrase: ')) dmsg('Passphrases: [{}] [{}]'.format(pw,pw2)) if pw == pw2: vmsg('Passphrases match'); break else: msg('Passphrases do not match. Try again.') else: die(2,'User failed to duplicate passphrase in {} attempts'.format(g.passwd_max_tries)) if pw == '': qmsg('WARNING: Empty passphrase') return pw