-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
bug(password reset): Add callback URL when invoking password reset vi…
…a email - ensure user is redirected to the front-end when link in email is clicked [#161044628]
- Loading branch information
Patrick Kimanje
authored and
Patrick Kimanje
committed
Oct 8, 2018
1 parent
c3318a6
commit bcef58d
Showing
4 changed files
with
35 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,22 @@ | ||
import os | ||
from django.core.mail import send_mail | ||
|
||
def send_password_reset_email(to_email, token, current_site): | ||
|
||
def send_password_reset_email(to_email, token, call_back_url): | ||
# current_site = os.environ.get("CURRENT_SITE") | ||
# email setup | ||
subject = 'Password reset' | ||
message = """ | ||
You're receiving this email because you invoked a password reset on | ||
Authors haven. If you think it is a mistake to receive this email just ignore it. | ||
----- Click the link below to reset your password ---- | ||
{}/api/user/reset-password/{} | ||
""".format(current_site, token) | ||
{}?{} | ||
""".format(call_back_url, token) | ||
from_email = os.environ.get('EMAIL_HOST_USER') | ||
to_email = to_email | ||
try: | ||
send_mail(subject, message, from_email, [to_email], fail_silently=False,) | ||
send_mail(subject, message, from_email, [to_email], fail_silently=False, ) | ||
except Exception as e: | ||
return {'email': str(e)} | ||
return {'email': str(e)} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters