Example #1
0
 def get_login_token(user: User):
     token, _dict = JWT.encrypt(dict(
         user_id=user.pk,
     ), expire_second=30 * 60 * 60 * 24)
     _dict['token'] = token
     _dict['user'] = user.d()
     return _dict
Example #2
0
 def get_login_token(user: User):
     token, _dict = JWT.encrypt(dict(
         user_id=user.pk,
     ))
     _dict['token'] = token
     _dict['user'] = user.d()
     return _dict
Example #3
0
 def get_login_token(user: User):
     token, dict_ = JWT.encrypt(
         dict(
             type=JWType.LOGIN_TOKEN,
             user_id=user.user_str_id,
         ))
     dict_['token'] = token
     dict_['user'] = user.d()
     return dict_
Example #4
0
File: auth.py Project: Jyonn/Rizya
 def get_login_token(user: User, session_key):
     if DEV_MODE:
         encrypt_session_key = session_key
     else:
         encrypt_session_key = Crypto.AES.encrypt(session_key)
     token, d = JWT.encrypt(
         dict(
             type=AuthType.LOGIN,
             user_id=user.user_id,
             session_key=encrypt_session_key,
         ))
     d['token'] = token
     d['user'] = user.d()
     return d