Skip to content

Commit

Permalink
Added password changed email
Browse files Browse the repository at this point in the history
  • Loading branch information
JustinWingChungHui committed Jul 18, 2019
1 parent 48871c5 commit c7a5a50
Show file tree
Hide file tree
Showing 19 changed files with 266 additions and 26 deletions.
34 changes: 33 additions & 1 deletion auth_api/signals.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from django.template.loader import get_template
from django.utils import translation

from django_rest_passwordreset.signals import reset_password_token_created
from django_rest_passwordreset.signals import reset_password_token_created, post_password_reset

from axes.signals import user_locked_out

Expand Down Expand Up @@ -75,3 +75,35 @@ def password_reset_token_created(sender, instance, reset_password_token, *args,
fail_silently=False,
html_message=content_html)



@receiver(post_password_reset)
def post_password_reset(user, *args, **kwargs):
"""
Called once user has changed password. Sends email to confirm change
"""
language = user.language

translation.activate(language)

subject = translation.ugettext('ok!Kindred Password Successfully Updated')

content = get_template('auth_api/password_changed_plain.html').render(
{
'language': language,
'domain' : settings.DOMAIN
})

content_html = get_template('auth_api/password_changed.html').render(
{
'language': language,
'domain' : settings.DOMAIN
})

send_mail(
subject,
content,
'[email protected]',
[user.email],
fail_silently=False,
html_message=content_html)
24 changes: 24 additions & 0 deletions auth_api/templates/auth_api/password_changed.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{% extends "base_email.html" %}
{% load i18n %}

{% block content %}

<p>
{% trans "Congratulations! Your password for ok!Kindred has just been updated." %}
</p>

<p>
{% trans "You can now login using your new password at:" %}
</p>

<p>
<a href="{{ domain }}">{{ domain }}</a>
</p>

<p>
{% trans "If you did not initiate this process, immediately contact us by replying to this email" %}
</p>



{% endblock %}
15 changes: 15 additions & 0 deletions auth_api/templates/auth_api/password_changed_plain.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@

{% load i18n %}


{% trans "Congratulations! Your password for ok!Kindred has just been updated." %}

{% trans "You can now login using your new password at:" %}

<a href="{{ domain }}">{{ domain }}</a>

{% trans "If you did not initiate this process, immediately contact us by replying to this email" %}




4 changes: 2 additions & 2 deletions auth_api/templates/auth_api/password_reset.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
{% trans "Please go to the following page and choose a new password:" %}
</p>
<p>
<a href ="{{ domain }}/password_reset_confirmation/?token={{ reset_password_token }}">
{{ domain }}/password_reset_confirmation/?token={{ reset_password_token }}
<a href ="{{ domain }}/accounts/password_reset_confirmation/?token={{ reset_password_token }}">
{{ domain }}/accounts/password_reset_confirmation/?token={{ reset_password_token }}
</a>
</p>

Expand Down
2 changes: 1 addition & 1 deletion auth_api/templates/auth_api/password_reset_plain.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@

{% trans "Please go to the following page and choose a new password:" %}

{{ domain }}/password_reset_confirmation/?token={{ reset_password_token }}
{{ domain }}/accounts/password_reset_confirmation/?token={{ reset_password_token }}
Binary file modified locale/en/LC_MESSAGES/django.mo
Binary file not shown.
27 changes: 26 additions & 1 deletion locale/en/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-07-17 13:53+0000\n"
"POT-Creation-Date: 2019-07-18 11:53+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <[email protected]>\n"
Expand All @@ -21,6 +21,31 @@ msgstr ""
msgid "ok!Kindred Password Reset"
msgstr "ok!Kindred Password Reset"

#: auth_api/signals.py:89
#, fuzzy
#| msgid "ok!Kindred Password Reset"
msgid "ok!Kindred Password Successfully Updated"
msgstr "ok!Kindred Password Reset"

#: auth_api/templates/auth_api/password_changed.html:7
#: auth_api/templates/auth_api/password_changed_plain.html:5
msgid "Congratulations! Your password for ok!Kindred has just been updated."
msgstr "Congratulations! Your password for ok!Kindred has just been updated."

#: auth_api/templates/auth_api/password_changed.html:11
#: auth_api/templates/auth_api/password_changed_plain.html:7
msgid "You can now login using your new password at:"
msgstr "You can now login using your new password at:"

#: auth_api/templates/auth_api/password_changed.html:19
#: auth_api/templates/auth_api/password_changed_plain.html:11
msgid ""
"If you did not initiate this process, immediately contact us by replying to "
"this email"
msgstr ""
"If you did not initiate this process, immediately contact us by replying to "
"this email"

#: auth_api/templates/auth_api/password_reset.html:7
#: auth_api/templates/auth_api/password_reset_plain.html:4
msgid ""
Expand Down
Binary file modified locale/fi/LC_MESSAGES/django.mo
Binary file not shown.
31 changes: 28 additions & 3 deletions locale/fi/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-07-17 13:53+0000\n"
"POT-Creation-Date: 2019-07-18 11:53+0000\n"
"PO-Revision-Date: 2015-05-11 08:55+0000\n"
"Last-Translator: b'Anonymous User'\n"
"Language-Team: LANGUAGE <[email protected]>\n"
Expand All @@ -23,14 +23,39 @@ msgstr ""
msgid "ok!Kindred Password Reset"
msgstr "ok!Kindred Salasanan Nollaus"

#: auth_api/signals.py:89
#, fuzzy
#| msgid "ok!Kindred Password Reset"
msgid "ok!Kindred Password Successfully Updated"
msgstr "ok!Kindred Salasanan Nollaus"

#: auth_api/templates/auth_api/password_changed.html:7
#: auth_api/templates/auth_api/password_changed_plain.html:5
msgid "Congratulations! Your password for ok!Kindred has just been updated."
msgstr "Onnittelut! Salasanasi ok!Kindred on juuri päivitetty"

#: auth_api/templates/auth_api/password_changed.html:11
#: auth_api/templates/auth_api/password_changed_plain.html:7
msgid "You can now login using your new password at:"
msgstr "Nyt voit kirjautua uuden salasanasi avulla osoitteeseen:"

#: auth_api/templates/auth_api/password_changed.html:19
#: auth_api/templates/auth_api/password_changed_plain.html:11
msgid ""
"If you did not initiate this process, immediately contact us by replying to "
"this email"
msgstr ""
"Jos et käynnistä tätä prosessia, ota välittömästi yhteyttä meihin vastaamalla"
"Tämä sähköposti"

#: auth_api/templates/auth_api/password_reset.html:7
#: auth_api/templates/auth_api/password_reset_plain.html:4
msgid ""
"You're receiving this email because you requested a password reset for your "
"user account at ok!Kindred"
msgstr ""
"Saat tämän sähköpostiviestin, koska olet pyytänyt salasanan palauttamista"
"käyttäjätili ok!Kindred"
"Saat tämän sähköpostiviestin, koska olet pyytänyt salasanan "
"palauttamistakäyttäjätili ok!Kindred"

#: auth_api/templates/auth_api/password_reset.html:11
#: auth_api/templates/auth_api/password_reset_plain.html:6
Expand Down
Binary file modified locale/fr/LC_MESSAGES/django.mo
Binary file not shown.
33 changes: 29 additions & 4 deletions locale/fr/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-07-17 13:53+0000\n"
"POT-Creation-Date: 2019-07-18 11:53+0000\n"
"PO-Revision-Date: 2015-05-11 08:53+0000\n"
"Last-Translator: b'Anonymous User'\n"
"Language-Team: LANGUAGE <[email protected]>\n"
Expand All @@ -20,17 +20,42 @@ msgstr ""
"X-Translated-Using: django-rosetta 0.7.5\n"

#: auth_api/signals.py:54
msgid "Réinitialiser votre Mot de Passe ok!Kindred"
msgid "ok!Kindred Password Reset"
msgstr ""

#: auth_api/signals.py:89
#, fuzzy
#| msgid "ok!Kindred family update"
msgid "ok!Kindred Password Successfully Updated"
msgstr "ok! Kindred mise à jour de la famille"

#: auth_api/templates/auth_api/password_changed.html:7
#: auth_api/templates/auth_api/password_changed_plain.html:5
msgid "Congratulations! Your password for ok!Kindred has just been updated."
msgstr "Félicitations! Votre mot de passe pour ok!Kindred vient d'être mis à jour."

#: auth_api/templates/auth_api/password_changed.html:11
#: auth_api/templates/auth_api/password_changed_plain.html:7
msgid "You can now login using your new password at:"
msgstr "Vous pouvez maintenant vous connecter en utilisant votre nouveau mot de passe à:"

#: auth_api/templates/auth_api/password_changed.html:19
#: auth_api/templates/auth_api/password_changed_plain.html:11
msgid ""
"If you did not initiate this process, immediately contact us by replying to "
"this email"
msgstr ""
"Si vous n'avez pas lancé ce processus, contactez-nous immédiatement en répondant à"
"cet e-mail"

#: auth_api/templates/auth_api/password_reset.html:7
#: auth_api/templates/auth_api/password_reset_plain.html:4
msgid ""
"You're receiving this email because you requested a password reset for your "
"user account at ok!Kindred"
msgstr ""
"Vous recevez cet email car vous avez demandé une réinitialisation du mot de passe pour votre"
"compte utilisateur à ok!Kindred"
"Vous recevez cet email car vous avez demandé une réinitialisation du mot de "
"passe pour votrecompte utilisateur à ok!Kindred"

#: auth_api/templates/auth_api/password_reset.html:11
#: auth_api/templates/auth_api/password_reset_plain.html:6
Expand Down
Binary file modified locale/pl/LC_MESSAGES/django.mo
Binary file not shown.
31 changes: 28 additions & 3 deletions locale/pl/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-07-17 13:53+0000\n"
"POT-Creation-Date: 2019-07-18 11:53+0000\n"
"PO-Revision-Date: 2015-06-08 21:45+0000\n"
"Last-Translator: b'Anonymous User'\n"
"Language-Team: LANGUAGE <[email protected]>\n"
Expand All @@ -24,14 +24,39 @@ msgstr ""
msgid "ok!Kindred Password Reset"
msgstr "ok!Kindred Zresetowanie Hasła"

#: auth_api/signals.py:89
#, fuzzy
#| msgid "ok!Kindred Password Reset"
msgid "ok!Kindred Password Successfully Updated"
msgstr "ok!Kindred Zresetowanie Hasła"

#: auth_api/templates/auth_api/password_changed.html:7
#: auth_api/templates/auth_api/password_changed_plain.html:5
msgid "Congratulations! Your password for ok!Kindred has just been updated."
msgstr "Gratulacje! Twoje hasło na ok!Kindred zostało właśnie zaktualizowane."

#: auth_api/templates/auth_api/password_changed.html:11
#: auth_api/templates/auth_api/password_changed_plain.html:7
msgid "You can now login using your new password at:"
msgstr "Możesz teraz zalogować się przy użyciu nowego hasła pod adresem:"

#: auth_api/templates/auth_api/password_changed.html:19
#: auth_api/templates/auth_api/password_changed_plain.html:11
msgid ""
"If you did not initiate this process, immediately contact us by replying to "
"this email"
msgstr ""
"Jeśli nie zainicjowałeś tego procesu, natychmiast skontaktuj się z nami, odpowiadając na"
"ten email"

#: auth_api/templates/auth_api/password_reset.html:7
#: auth_api/templates/auth_api/password_reset_plain.html:4
msgid ""
"You're receiving this email because you requested a password reset for your "
"user account at ok!Kindred"
msgstr ""
"Otrzymujesz ten e-mail, ponieważ zażądałeś zresetowania hasła dla swojego "
"konto użytkownika w ok!Kindred"
"Otrzymujesz ten e-mail, ponieważ zażądałeś zresetowania hasła dla swojego "
"konto użytkownika w ok!Kindred"

#: auth_api/templates/auth_api/password_reset.html:11
#: auth_api/templates/auth_api/password_reset_plain.html:6
Expand Down
Binary file modified locale/zh_CN/LC_MESSAGES/django.mo
Binary file not shown.
29 changes: 26 additions & 3 deletions locale/zh_CN/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-07-17 13:53+0000\n"
"POT-Creation-Date: 2019-07-18 11:53+0000\n"
"PO-Revision-Date: 2015-06-15 04:58+0000\n"
"Last-Translator: b'Anonymous User <[email protected]>'\n"
"Language-Team: LANGUAGE <[email protected]>\n"
Expand All @@ -22,14 +22,37 @@ msgstr ""
msgid "ok!Kindred Password Reset"
msgstr "ok!Kindred 重设密码"

#: auth_api/signals.py:89
#, fuzzy
#| msgid "ok!Kindred Password Reset"
msgid "ok!Kindred Password Successfully Updated"
msgstr "ok!Kindred 重设密码"

#: auth_api/templates/auth_api/password_changed.html:7
#: auth_api/templates/auth_api/password_changed_plain.html:5
msgid "Congratulations! Your password for ok!Kindred has just been updated."
msgstr "恭喜! 您的密码 ok!Kindred 刚刚更新。"

#: auth_api/templates/auth_api/password_changed.html:11
#: auth_api/templates/auth_api/password_changed_plain.html:7
msgid "You can now login using your new password at:"
msgstr "您现在可以使用新密码登录:"

#: auth_api/templates/auth_api/password_changed.html:19
#: auth_api/templates/auth_api/password_changed_plain.html:11
msgid ""
"If you did not initiate this process, immediately contact us by replying to "
"this email"
msgstr "您现在可以使用新密码登录:"

#: auth_api/templates/auth_api/password_reset.html:7
#: auth_api/templates/auth_api/password_reset_plain.html:4
msgid ""
"You're receiving this email because you requested a password reset for your "
"user account at ok!Kindred"
msgstr ""
"您收到此电子邮件是因为您要求重置密码"
"用户帐户 ok!Kindred"
"如果您没有启动此过程,请立即通过回复与我们联系"
"这封电子邮件"

#: auth_api/templates/auth_api/password_reset.html:11
#: auth_api/templates/auth_api/password_reset_plain.html:6
Expand Down
Binary file modified locale/zh_HK/LC_MESSAGES/django.mo
Binary file not shown.
Loading

0 comments on commit c7a5a50

Please sign in to comment.