email: Add reset button to password reset email.

This commit is contained in:
Vishnu Ks
2017-11-19 21:40:37 +00:00
committed by Tim Abbott
parent c8edbae21c
commit 9c50819dd6
3 changed files with 9 additions and 4 deletions

View File

@@ -224,7 +224,6 @@ class ZulipPasswordResetForm(PasswordResetForm):
'email': email,
'realm_uri': realm.uri,
'user': user,
'protocol': 'https' if use_https else 'http',
}
if user is not None and user_matches_subdomain(subdomain, user):
@@ -232,6 +231,11 @@ class ZulipPasswordResetForm(PasswordResetForm):
context['token'] = token_generator.make_token(user)
context['uid'] = urlsafe_base64_encode(force_bytes(user.id))
protocol = 'https' if use_https else 'http'
endpoint = reverse('django.contrib.auth.views.password_reset_confirm',
kwargs=dict(uidb64=context['uid'], token=context['token']))
context['reset_url'] = "{}://{}{}".format(protocol, user.realm.host, endpoint)
send_email('zerver/emails/password_reset', to_user_id=user.id,
from_name="Zulip Account Security",
from_address=FromAddress.NOREPLY, context=context)