コード例 #1
0
    def validate_password_confirmation(self, data):
        password = data.get('password')
        confirm = data.get('confirm')
        target_user = get_current_user()
        user_id = data.get('id')

        if is_admin():
            if password:
                data['password'] = hash_password(data['password'])
                return data
        else:
            if password and (confirm is None):
                raise ValidationError('Please confirm your current password', field_names=['confirm'])

            if password and confirm:
                test = verify_password(plaintext=confirm, ciphertext=target_user.password)
                if test is True:
                    data['password'] = hash_password(data['password'])
                    return data
                else:
                    raise ValidationError('Your previous password is incorrect', field_names=['confirm'])
コード例 #2
0
    def __init__(self, name, **kwargs):
        self.name = name
        self.password = hash_password(kwargs['password'])
        self.email = kwargs['email']
        self.TYPE = kwargs['type']

        self.website = kwargs['website'] if 'website' in kwargs else None
        self.affiliation = kwargs[
            'affiliation'] if 'affiliation' in kwargs else None
        self.country = kwargs['country'] if 'country' in kwargs else None
        self.hidden = kwargs['hidden'] if 'hidden' in kwargs else 1
        self.verified = kwargs['verified'] if 'verified' in kwargs else 0
        self.banned = kwargs['banned'] if 'banned' in kwargs else 0
コード例 #3
0
ファイル: __init__.py プロジェクト: xmsec/LanCTFd
 def validate_password(self, key, plaintext):
     return hash_password(str(plaintext))
コード例 #4
0
    def validate_password(self, key, plaintext):
        from CTFd.utils.crypto import hash_password

        return hash_password(str(plaintext))
コード例 #5
0
ファイル: __init__.py プロジェクト: shareef12/CTFd
 def __init__(self, **kwargs):
     super(Teams, self).__init__(**kwargs)
     if kwargs.get('password'):
         self.password = hash_password(str(kwargs['password']))
コード例 #6
0
def test_hash_password():
    assert hash_password("asdf").startswith("$bcrypt-sha256")
コード例 #7
0
ファイル: test_passwords.py プロジェクト: mrigank-9594/srhctf
def test_hash_password():
    assert hash_password('asdf').startswith('$bcrypt-sha256')