コード例 #1
0
ファイル: users.py プロジェクト: princessGasmask/szurubooru
def update_password(user, password):
    if not password:
        raise InvalidPasswordError('Password cannot be empty.')
    password_regex = config.config['password_regex']
    if not re.match(password_regex, password):
        raise InvalidPasswordError(
            'Password must satisfy regex %r.' % password_regex)
    user.password_salt = auth.create_password()
    user.password_hash = auth.get_password_hash(user.password_salt, password)
コード例 #2
0
ファイル: users.py プロジェクト: sun-beyond/szurubooru
def reset_user_password(user: model.User) -> str:
    assert user
    password = auth.create_password()
    user.password_salt = auth.create_password()
    password_hash, revision = auth.get_password_hash(user.password_salt,
                                                     password)
    user.password_hash = password_hash
    user.password_revision = revision
    return password
コード例 #3
0
ファイル: users.py プロジェクト: rr-/szurubooru
def reset_user_password(user: model.User) -> str:
    assert user
    password = auth.create_password()
    user.password_salt = auth.create_password()
    password_hash, revision = auth.get_password_hash(
        user.password_salt, password)
    user.password_hash = password_hash
    user.password_revision = revision
    return password
コード例 #4
0
ファイル: test_auth.py プロジェクト: sun-beyond/szurubooru
def test_get_password_hash():
    salt, password = ('testSalt', 'pass')
    result, revision = auth.get_password_hash(salt, password)
    assert result
    assert revision == 3
    hash_parts = list(
        filter(lambda e: e is not None and e != '', result.split('$')))
    assert len(hash_parts) == 5
    assert hash_parts[0] == 'argon2id'
コード例 #5
0
def update_user_password(user, password):
    if not password:
        raise InvalidPasswordError('Password cannot be empty.')
    password_regex = config.config['password_regex']
    if not re.match(password_regex, password):
        raise InvalidPasswordError('Password must satisfy regex %r.' %
                                   password_regex)
    user.password_salt = auth.create_password()
    user.password_hash = auth.get_password_hash(user.password_salt, password)
コード例 #6
0
ファイル: test_auth.py プロジェクト: stopsquarks/quarkman
def test_get_password_hash():
    salt, password = ("testSalt", "pass")
    result, revision = auth.get_password_hash(salt, password)
    assert result
    assert revision == 3
    hash_parts = list(
        filter(lambda e: e is not None and e != "", result.split("$"))
    )
    assert len(hash_parts) == 5
    assert hash_parts[0] == "argon2id"
コード例 #7
0
ファイル: users.py プロジェクト: rr-/szurubooru
def update_user_password(user: model.User, password: str) -> None:
    assert user
    if not password:
        raise InvalidPasswordError('Password cannot be empty.')
    password_regex = config.config['password_regex']
    if not re.match(password_regex, password):
        raise InvalidPasswordError(
            'Password must satisfy regex %r.' % password_regex)
    user.password_salt = auth.create_password()
    password_hash, revision = auth.get_password_hash(
        user.password_salt, password)
    user.password_hash = password_hash
    user.password_revision = revision
コード例 #8
0
ファイル: users.py プロジェクト: sun-beyond/szurubooru
def update_user_password(user: model.User, password: str) -> None:
    assert user
    if not password:
        raise InvalidPasswordError('Password cannot be empty.')
    password_regex = config.config['password_regex']
    if not re.match(password_regex, password):
        raise InvalidPasswordError('Password must satisfy regex %r.' %
                                   password_regex)
    user.password_salt = auth.create_password()
    password_hash, revision = auth.get_password_hash(user.password_salt,
                                                     password)
    user.password_hash = password_hash
    user.password_revision = revision
コード例 #9
0
ファイル: users.py プロジェクト: yf-dev/yfbooru
def update_user_password(user: model.User, password: str) -> None:
    assert user
    if not password:
        raise InvalidPasswordError('비밀번호는 빈 값일 수 없습니다.')
    password_regex = config.config['password_regex']
    if not re.match(password_regex, password):
        raise InvalidPasswordError('비밀번호는 다음의 정규식을 만족해야 합니다: %r' %
                                   password_regex)
    user.password_salt = auth.create_password()
    password_hash, revision = auth.get_password_hash(user.password_salt,
                                                     password)
    user.password_hash = password_hash
    user.password_revision = revision
コード例 #10
0
ファイル: users.py プロジェクト: princessGasmask/szurubooru
def reset_password(user):
    password = auth.create_password()
    user.password_salt = auth.create_password()
    user.password_hash = auth.get_password_hash(user.password_salt, password)
    return password
コード例 #11
0
ファイル: users.py プロジェクト: zeazje/szurubooru
def reset_user_password(user: model.User) -> str:
    assert user
    password = auth.create_password()
    user.password_salt = auth.create_password()
    user.password_hash = auth.get_password_hash(user.password_salt, password)
    return password
コード例 #12
0
def reset_user_password(user):
    password = auth.create_password()
    user.password_salt = auth.create_password()
    user.password_hash = auth.get_password_hash(user.password_salt, password)
    return password