Пример #1
0
def login_by_email(email, password):
	credentials = user_dao.get_credentials_by_email(email)

	if auth_service.check_password(password, credentials.password_hash, credentials.salt):
		return credentials.user_id
	else:
		return None
Пример #2
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