Skip to content

Commit

Permalink
swap out token generator
Browse files Browse the repository at this point in the history
  • Loading branch information
Bianca Yang committed Mar 19, 2024
1 parent c70fc7b commit d407fd3
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions posthog/admin/admins/user_admin.py
Original file line number Diff line number Diff line change
@@ -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


Expand All @@ -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'<a target="_blank" href="/reset/{self.instance.uuid}/{password_reset_token}">this password reset link</a> '
Expand Down

0 comments on commit d407fd3

Please sign in to comment.