-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #83 from nens/basten-customize_email
Invitation mail: Service email address is now interpolated, also added dutch version
- Loading branch information
Showing
5 changed files
with
32 additions
and
6 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -233,17 +233,28 @@ def send_email(self, request, context=None, send_email_options=None): | |
"host": request.get_host(), | ||
**(context or {}), | ||
} | ||
|
||
text = render_to_string("nens_auth_client/invitation.txt", context=context) | ||
html = render_to_string("nens_auth_client/invitation.html", context=context) | ||
if context.get("service_email", None) is None: | ||
context["service_email"] = r"[email protected]" | ||
|
||
inv_lang = send_email_options.get("invitation_language", "en") | ||
if inv_lang == "en": | ||
text = render_to_string("nens_auth_client/invitation.txt", context=context) | ||
html = render_to_string("nens_auth_client/invitation.html", context=context) | ||
elif inv_lang == "nl": | ||
text = render_to_string("nens_auth_client/uitnodiging.txt", context=context) | ||
html = render_to_string( | ||
"nens_auth_client/uitnodiging.html", context=context | ||
) | ||
else: | ||
raise Exception(f"Unknown language code: {inv_lang}") | ||
|
||
send_mail( | ||
from_email=None, # uses DEFAULT_FROM_EMAIL setting | ||
subject=settings.NENS_AUTH_INVITATION_EMAIL_SUBJECT, | ||
message=text, | ||
html_message=html, | ||
recipient_list=[self.email], | ||
**(send_email_options or {}) | ||
**(send_email_options or {}), | ||
) | ||
|
||
self.email_sent_at = timezone.now() | ||
|
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 |
---|---|---|
|
@@ -2,4 +2,4 @@ | |
<p>This is an invitation for a user account at {{ host }}.<br />Use the following link to accept:</p> | ||
<p><a href="{{ accept_url }}">{{ accept_url }}</a></p> | ||
<p>The above link will first redirect to a page where you can sign in with a corporate ID or a Nelen & Schuurmans account. If you do not have an account in any of the options listed, choose "Sign up".</p> | ||
<p>For questions, please contact [email protected].</p> | ||
<p>For questions, please contact {{ service_email }}.</p> |
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 |
---|---|---|
|
@@ -9,4 +9,4 @@ The above link will first redirect to a page where you can sign in | |
with a corporate ID or a Nelen & Schuurmans account. If you do not have an | ||
account in any of the options listed, choose "Sign up". | ||
|
||
For questions, please contact [email protected]. | ||
For questions, please contact {{ service_email }}. |
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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<p>Beste gebruiker,</p> | ||
<p>Dit is een uitnodigingsmail voor een gebruikersaccount voor {{ host }}.<br />Klik op onderstaande link om deze uitnodiging te accepteren:</p> | ||
<p><a href="{{ accept_url }}">{{ accept_url }}</a></p> | ||
<p>Deze link stuurt u door naar de inlogpagina waar u kunt inloggen met uw eigen corporate ID.</p> | ||
<p>Mocht u vragen hebben, neem dan contact op met {{service_email}}.</p> |
10 changes: 10 additions & 0 deletions
10
nens_auth_client/templates/nens_auth_client/uitnodiging.txt
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 |
---|---|---|
@@ -0,0 +1,10 @@ | ||
Beste gebruiker, | ||
|
||
Dit is een uitnodigingsmail voor een gebruikersaccount voor {{ host }}. | ||
Klik op onderstaande link om deze uitnodiging te accepteren: | ||
|
||
{{ accept_url }} | ||
|
||
Deze link stuurt u door naar de inlogpagina waar u kunt inloggen met uw eigen corporate ID. | ||
|
||
Mocht u vragen hebben, neem dan contact op met {{service_email}}. |