Ejemplo n.º 1
0
def update_user_credentials(user_obj, old_password, new_password):
	credentials = user_dao.get_credentials_by_email(user_obj.email)

	if auth_service.check_password(old_password, credentials.password_hash, credentials.salt):
		hashed, salt = auth_service.hash_password(new_password)

		return user_dao.update_user_credentials(user_obj, hashed, salt)
	else:
		return False
Ejemplo n.º 2
0
def create_new_user(user, new_password, confirm_password):
	"""
	Create a new user. Throws exceptions if the provided information is incorrect

	Returns the result of the user creation
	"""

	validate_user(user)
	validate_password(new_password, confirm_password)

	#TODO create user by phone as well
	password_hash, salt = auth_service.hash_password(new_password)

	return user_dao.create_user_by_email(user, password_hash, salt)
Ejemplo n.º 3
0
def create_new_user(user_obj, new_password):
	#TODO create user by phone as well
	password_hash, salt = auth_service.hash_password(new_password)

	return user_dao.create_user_by_email(user_obj, password_hash, salt)