From d407fd35559c09d612f29d81e72f70775fdac1bc Mon Sep 17 00:00:00 2001 From: Bianca Yang Date: Tue, 19 Mar 2024 16:47:42 -0700 Subject: [PATCH] swap out token generator --- posthog/admin/admins/user_admin.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/posthog/admin/admins/user_admin.py b/posthog/admin/admins/user_admin.py index c1129ef334fa4..9872fad946f30 100644 --- a/posthog/admin/admins/user_admin.py +++ b/posthog/admin/admins/user_admin.py @@ -1,12 +1,11 @@ -from django.utils.html import format_html - from django.contrib.auth.admin import UserAdmin as DjangoUserAdmin from django.contrib.auth.forms import UserChangeForm as DjangoUserChangeForm -from django.contrib.auth.tokens import default_token_generator +from django.utils.html import format_html from django.utils.translation import gettext_lazy as _ from posthog.admin.inlines.organization_member_inline import OrganizationMemberInline from posthog.admin.inlines.totp_device_inline import TOTPDeviceInline +from posthog.api.authentication import password_reset_token_generator from posthog.models import User @@ -18,7 +17,7 @@ def __init__(self, *args, **kwargs): # we have a link to the password reset page which the _user_ can use themselves. # This way if some user needs to reset their password and there's a problem with receiving the reset link email, # an admin can provide that reset link manually – much better than sending a new password in plain text. - password_reset_token = default_token_generator.make_token(self.instance) + password_reset_token = password_reset_token_generator.make_token(self.instance) self.fields["password"].help_text = ( "Raw passwords are not stored, so there is no way to see this user’s password, but you can send them " f'this password reset link '