How to use the muffin.utils.check_password_hash function in muffin

To help you get started, we’ve selected a few muffin examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github klen / muffin / tests / test_utils.py View on Github external
def test_generate_password_hash_sha256():
    from muffin.utils import generate_password_hash, check_password_hash

    password = '#secret$'
    password_hash = generate_password_hash(password, digestmod='sha256', salt_length=20)

    assert password_hash.startswith('sha256')
    assert len(password_hash.split('$')[1]) == 20
    assert len(password_hash.split('$')[2]) == 64
    assert check_password_hash(password, password_hash)
github klen / muffin / tests / test_utils.py View on Github external
def test_generate_password_hash_default():
    from muffin.utils import generate_password_hash, check_password_hash

    password = '#secret$'
    password_hash = generate_password_hash(password, digestmod='sha1', salt_length=8)

    assert password_hash.startswith('sha1')
    assert len(password_hash.split('$')[1]) == 8
    assert len(password_hash.split('$')[2]) == 40
    assert check_password_hash(password, password_hash)
github klen / muffin / tests / test_muffin.py View on Github external
def test_password_hash():
    pwhash = muffin.utils.generate_password_hash('pass')
    assert pwhash

    assert not muffin.utils.check_password_hash('wrong', pwhash)
    assert muffin.utils.check_password_hash('pass', pwhash)
github klen / muffin / example / models.py View on Github external
def check_password(self, password):
        return check_password_hash(password, self.password)