Example #1
0
def gen_pass():
    try:
        pass_len = request.form['pass-length']
        slang = request.form['slang']
        print pass_len
        print slang
        word_list = passphrase_functions.open_file(slang)
        passphrase = passphrase_functions.gen_pw(int(pass_len), word_list)
        flash(passphrase)
        return redirect('/')
    except KeyError:
        pass_len = 3
        slang = '415words.txt'
        word_list = passphrase_functions.open_file(slang)
        passphrase = passphrase_functions.gen_pw(int(pass_len), word_list)
        flash(passphrase)
        return redirect('/')
Example #2
0
def gen_pass():
	try:
		pass_len = request.form['pass-length']
		slang = request.form['slang']
		print pass_len
		print slang
		word_list = passphrase_functions.open_file(slang)
		passphrase = passphrase_functions.gen_pw(int(pass_len), word_list)
		flash(passphrase)
		return redirect('/')
	except KeyError:
		pass_len = 3
		slang = '415words.txt'
		word_list = passphrase_functions.open_file(slang)
		passphrase = passphrase_functions.gen_pw(int(pass_len), word_list)
		flash(passphrase)
		return redirect('/')
Example #3
0
def test_change_password():
	'''Assert that the password field has been updated to a new password'''
	user_id = 3
	user_name = 'mladmin'
	user_new_password = passphrase_functions.gen_pw(3)
	change_pw_result = core.change_pw(user_id, user_new_password)
	authenticate_result = core.authenticate(user_name, user_new_password)
	tools.assert_equals(change_pw_result, 'Your password has been updated')
	tools.assert_equals(authenticate_result.id, user_id)
Example #4
0
def reset_pw(username, email):
	user = orm.session.query(orm.User).filter_by(username=username, email=email).first()
	if user:
		temp_pass = passphrase_functions.gen_pw(3)
		user.password = encrypt_pw(temp_pass)
		orm.session.commit()
		alerts.send_pw_email(email, temp_pass)
		return 'Password reset. Please check your email for your new password.'
	else:
		return 'Your account was not found in our system. Do you have the correct username and email address?'