domain: server
language: python
class Task class
Use check_password_hash
to check a password against a given salted and hashed
password value.
The method is wrapper over Werkzeug check_password_hash function: https://werkzeug.palletsprojects.com/en/0.15.x/utils/
def on_login(task, login, password, ip, session_uuid):
users = task.users.copy(handlers=False)
users.set_where(login=login)
users.open()
for u in users:
if task.check_password_hash(u.password_hash.value, password):
return {
'user_id': users.id.value,
'user_name': users.name.value,
'role_id': users.role.value,
'role_name': users.role.display_text
}