fix: 重置密码连接生成多个token

pull/6858/head
xinwen 2021-09-14 20:08:33 +08:00 committed by 老广
parent 870dac37b9
commit d22bb2c92f
1 changed files with 7 additions and 2 deletions

View File

@ -7,6 +7,11 @@ from notifications.notifications import UserMessage
class ResetPasswordMsg(UserMessage):
def __init__(self, user):
super().__init__(user)
self.reset_passwd_token = user.generate_reset_token()
def get_text_msg(self) -> dict:
user = self.user
subject = _('Reset password')
@ -30,7 +35,7 @@ Login direct 👇
""") % {
'name': user.name,
'rest_password_url': reverse('authentication:reset-password', external=True),
'rest_password_token': user.generate_reset_token(),
'rest_password_token': self.reset_passwd_token,
'forget_password_url': reverse('authentication:forgot-password', external=True),
'email': user.email,
'login_url': reverse('authentication:login', external=True),
@ -62,7 +67,7 @@ Login direct 👇
""") % {
'name': user.name,
'rest_password_url': reverse('authentication:reset-password', external=True),
'rest_password_token': user.generate_reset_token(),
'rest_password_token': self.reset_passwd_token,
'forget_password_url': reverse('authentication:forgot-password', external=True),
'email': user.email,
'login_url': reverse('authentication:login', external=True),