Exemplo n.º 1
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)
Exemplo n.º 2
0
def login():
	err_msg = 'Incorrect username or password.'
	username = request.form['username']
	password = request.form['password']
	authenticated = core.authenticate(username, password)
	if authenticated == None:
		flash(err_msg) 
		return redirect('/')
	else:
		session['username'] = authenticated.username
		session['id'] = authenticated.id
		return redirect('/dashboard')
Exemplo n.º 3
0
def add_result_db(item, date, http_result, post_user, post_pw):
	user = core.authenticate(post_user, post_pw)
	if user is not None:
		core.add_result(item.url.id, date, http_result['code'], http_result['time'])
Exemplo n.º 4
0
 def authenticate_agent(self, email, password, hashed_password):
     return core.authenticate(email, password, hashed_password)