Jam.py documentation

check_password_hash

check_password_hash(self, pwhash, password)

domain: server

language: python

class Task class

Description

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/

Example

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
          }