Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions mg/handlers/app_mg_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,8 @@ def put(self, *args, **kwargs):
token_info = dict(user_id=user_id, username=user_info.username, nickname=user_info.nickname,
is_superuser=is_superuser, exp_time=1100)
auth_token = AuthToken()
auth_key = auth_token.encode_auth_token(**token_info)
auth_key = auth_token.encode_auth_token_v2(**token_info)
if isinstance(auth_key, bytes): auth_key = auth_key.decode()

redis_conn = cache_conn()
configs_init('all')
Expand All @@ -268,11 +269,11 @@ def put(self, *args, **kwargs):
mail_to = session.query(Users.email).filter(Users.user_id == self.get_current_id()).first()

if mail_to[0] == user_info.email:
obj.send_mail(mail_to[0], '令牌,有效期三年', auth_key.decode(), subtype='plain')
obj.send_mail(mail_to[0], '令牌,有效期三年', auth_key, subtype='plain')
else:
obj.send_mail(mail_to[0], '令牌,有效期三年', auth_key.decode(), subtype='plain')
obj.send_mail(user_info.email, '令牌,有效期三年', auth_key.decode(), subtype='plain')
return self.write(dict(code=0, msg='Token已经发送到邮箱', data=auth_key.decode()))
obj.send_mail(mail_to[0], '令牌,有效期三年', auth_key, subtype='plain')
obj.send_mail(user_info.email, '令牌,有效期三年', auth_key, subtype='plain')
return self.write(dict(code=0, msg='Token已经发送到邮箱', data=auth_key))


app_mg_urls = [
Expand Down