コード例 #1
0
ファイル: access_control.py プロジェクト: mRokita/sMusic-www
def generate_new_api_key(user):
    new_api_key = secure_random_string_generator(32)
    new_api_key_hash = get_hash_for_api_key(new_api_key)
    user.api_key = new_api_key_hash.encode("utf8")
    db.session.add(user)
    db.session.commit()
    return new_api_key
コード例 #2
0
ファイル: access_control.py プロジェクト: mRokita/sMusic-www
 def __init__(self, login="******", password="", roles=None):
     if roles is None:
         roles = []
     self.login = login
     self.display_name = login
     if password == "":
         password = secure_random_string_generator(32)
     self.password = pwd_context.encrypt(password)
     self.is_active = True
     self.roles = roles
     self.api_key = ""