From d22bb2c92fe6252cb17f1a7ba283881624a2adc4 Mon Sep 17 00:00:00 2001 From: xinwen Date: Tue, 14 Sep 2021 20:08:33 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E9=87=8D=E7=BD=AE=E5=AF=86=E7=A0=81?= =?UTF-8?q?=E8=BF=9E=E6=8E=A5=E7=94=9F=E6=88=90=E5=A4=9A=E4=B8=AAtoken?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/users/notifications.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/apps/users/notifications.py b/apps/users/notifications.py index 224a5c06a..87eae3b42 100644 --- a/apps/users/notifications.py +++ b/apps/users/notifications.py @@ -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),