Jam.py documentation

generate_password_hash

generate_password_hash(self, password, method='pbkdf2:sha256', salt_length=8)

domain: server

language: python

class Task class

Description

This method hash a password with the given method and salt with a string of the given length. The format of the string returned includes the method that was used so that check_password_hash can check the hash.

The method is wrapper over Werkzeug generate_password_hash function: https://werkzeug.palletsprojects.com/en/0.15.x/utils/

Example

def on_apply(item, delta, params, connection):
    for d in delta:
        if d.password.value:
            d.edit();
            d.password_hash.value = delta.task.generate_password_hash(d.password.value)
            d.password.value = None
            d.post();