-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Updated email text and formatting (#140)
- Loading branch information
1 parent
2d0f120
commit 2b3655b
Showing
3 changed files
with
160 additions
and
26 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 |
---|---|---|
@@ -1,61 +1,194 @@ | ||
# coding=utf-8 | ||
""" | ||
Template emails for account maintence activities. Note that | ||
the salt does not need to be secure for these particular activities, | ||
since signing with the secret key is enough for these short lived | ||
operations. | ||
""" | ||
|
||
open_tag = '''<p style="font-family: sans-serif; font-size: 14px; font-weight: normal; margin: 0; Margin-bottom: 15px;">''' | ||
|
||
html_template = """ | ||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> | ||
<html> | ||
<head> | ||
<meta name="viewport" content="width=device-width"> | ||
<meta http-equiv="Content-Type" content="text/html charset=UTF-8" /> | ||
</head> | ||
<body> | ||
<table border="0" cellpadding="0" cellspacing="0" height="100%" width="100%" id="bodyTable" style="background-color: #E0E0E0;"> | ||
<tr> | ||
<td align="center" valign="top"> | ||
<table border="0" cellpadding="10" cellspacing="0" width="600" id="emailContainer"> | ||
<tr> | ||
<td align="center" valign="top"> | ||
<table border="0" cellpadding="20" cellspacing="0" width="100%" id="emailHeader"> | ||
</table> | ||
</td> | ||
</tr> | ||
<tr> | ||
<td align="center" valign="top"> | ||
<table border="0" cellpadding="20" cellspacing="0" width="100%" id="emailBody" style="background-color: #ffffff;"> | ||
<tr> | ||
<td align="center" valign="top" background="https://ui.adsabs.harvard.edu/styles/img/background.jpg" style="width:100%; background-color: #150E35" > | ||
<img src="https://ui.adsabs.harvard.edu/styles/img/ads_logo.png" alt="Astrophysics Data System" style="width: 70%; color: #ffffff; font-size: 34px; font-family: sans-serif;"/> | ||
</td> | ||
</tr> | ||
<tr> | ||
<td align="left" valign="top"> | ||
{msg} | ||
</td> | ||
</tr> | ||
</table> | ||
</td> | ||
</tr> | ||
<tr> | ||
<td align="center" valign="top"> | ||
<table border="0" cellpadding="20" cellspacing="0" width="100%" id="emailFooter" style="color: #999999; font-size: 12px; text-align: center; font-family: sans-serif;"> | ||
<tr> | ||
<td align="center" valign="top"> | ||
<p> This message was sent to {email_address}. </p> | ||
<p> © SAO/NASA <a href="https://ui.adsabs.harvard.edu">Astrophysics Data System</a> <br> 60 Garden Street <br> Cambridge, MA</p> | ||
</td> | ||
</tr> | ||
</table> | ||
</td> | ||
</tr> | ||
</table> | ||
</td> | ||
</tr> | ||
</table> | ||
</body> | ||
</html> | ||
""" | ||
|
||
class Email(object): | ||
""" | ||
Data structure that contains email content data | ||
""" | ||
msg = '' | ||
msg_plain = '' | ||
msg_html = '' | ||
subject = '' | ||
salt = '' | ||
|
||
|
||
class PasswordResetEmail(Email): | ||
msg = '''Hi, | ||
Someone (probably you) has requested a password reset on the account associated with this email address. | ||
msg_plain = '''Hi, | ||
To reset your password, please visit | ||
<a href="{endpoint}">{endpoint}</a> with your browser. | ||
You’ve recently requested to reset your password for the NASA ADS account associated with this email address. | ||
Copy and paste the link below into your browser to reset it. | ||
This link will be valid for the next 10 minutes. | ||
{endpoint} | ||
If this is a mistake, then just ignore this email. | ||
This link is only valid for the next 24 hours. | ||
-The ADS team | ||
If you didn't request this, you can safely ignore this email. | ||
- the ADS team | ||
''' | ||
msg = '''{open_tag}Hi,</p> | ||
{open_tag}You've recently requested to reset your password for the <a href="https://ui.adsabs.harvard.edu">NASA ADS</a> | ||
account associated with this email address. Click the link below to reset it:</p> | ||
{open_tag}<a href="{endpoint}">{endpoint}</a></p> | ||
{open_tag}This link is only valid for the next 24 hours.</p> | ||
{open_tag}If you didn't request this, you can safely ignore this email.</p> | ||
{open_tag}- the ADS team</p>'''.format(open_tag=open_tag,endpoint='''{endpoint}''') | ||
msg_html = html_template.format(msg=msg,email_address='''{email_address}''') | ||
subject = "[ADS] Password reset" | ||
salt = 'password-reset-email' | ||
|
||
|
||
class VerificationEmail(Email): | ||
msg = ''' | ||
Hi, | ||
class WelcomeVerificationEmail(Email): | ||
msg_plain = '''Hi, | ||
Someone (probably you) has registered this email address with the NASA-ADS (http://ui.adsabs.harvard.edu). | ||
Welcome to the new NASA ADS! To finish setting up your account, please confirm your email address by copying and | ||
pasting the link below into your browser: | ||
To confirm this action, please visit | ||
<a href="{endpoint}">{endpoint}</a> with your browser. | ||
{endpoint} | ||
If this is a mistake, then just ignore this email. | ||
This link is only valid for the next 24 hours. | ||
-The ADS team''' | ||
If you didn't request this, you can safely ignore this email. | ||
- the ADS team | ||
''' | ||
|
||
msg = '''{open_tag}Hi,</p> | ||
{open_tag}Welcome to the new <a href="https://ui.adsabs.harvard.edu">NASA ADS</a>! To finish setting up your account, | ||
please confirm your email address:</p> | ||
{open_tag}<a href="{endpoint}">{endpoint}</a></p> | ||
{open_tag}This link is only valid for the next 24 hours.</p> | ||
{open_tag}If you didn't request this, you can safely ignore this email.</p> | ||
{open_tag}- the ADS team</p>'''.format(open_tag=open_tag,endpoint='''{endpoint}''') | ||
msg_html = html_template.format(msg=msg,email_address='''{email_address}''') | ||
subject = "[ADS] Please verify your email address" | ||
salt = 'verification-email' | ||
|
||
class VerificationEmail(Email): | ||
msg_plain = '''Hi, | ||
You've recently requested to change the email address associated with your NASA ADS account. To confirm this change, | ||
please copy and paste the link below into your browser: | ||
{endpoint} | ||
This link is only valid for the next 24 hours. | ||
If you didn't request this, you can safely ignore this email. | ||
- the ADS team | ||
''' | ||
|
||
msg = '''{open_tag}Hi,</p> | ||
{open_tag}You've recently requested to change the email address associated with your | ||
<a href="https://ui.adsabs.harvard.edu">NASA ADS</a> account. To confirm this change, please click the link below:</p> | ||
{open_tag}<a href="{endpoint}">{endpoint}</a></p> | ||
{open_tag}This link is only valid for the next 24 hours.</p> | ||
{open_tag}If you didn't request this, you can safely ignore this email.</p> | ||
{open_tag}- the ADS team</p>'''.format(open_tag=open_tag,endpoint='''{endpoint}''') | ||
msg_html = html_template.format(msg=msg,email_address='''{email_address}''') | ||
subject = "[ADS] Please verify your email address" | ||
salt = 'verification-email' | ||
|
||
class EmailChangedNotification(Email): | ||
msg = ''' | ||
Hi, | ||
msg_plain = '''Hi, | ||
You’ve recently requested to change the email address associated with your NASA ADS account. | ||
A verification email has been sent to the new email address. After the new email address has been confirmed, | ||
this email address will no longer be associated with your account. | ||
If you didn't request this, please reply to this email, or contact the support team at adshelp@cfa.harvard.edu directly. | ||
- the ADS team''' | ||
|
||
msg = '''{open_tag}Hi,</p> | ||
{open_tag}You’ve recently requested to change the email address associated with your | ||
<a href="https://ui.adsabs.harvard.edu">NASA ADS</a> account. </p> | ||
Someone (probably you) has just changed the email associated with this account. | ||
{open_tag}A verification email has been sent to the new email address. After the new email address has been confirmed, | ||
this email address will no longer be associated with your account.</p> | ||
A verification email to the new address was sent. After visiting the verification link therein, this email will no longer be associated with this account. | ||
{open_tag}If you didn't request this, please reply to this email, or contact the | ||
<a href="mailto:adshelp@cfa.harvard.edu">support team</a> directly.</p> | ||
If you need further support, please contact ads@cfa.harvard.edu. | ||
{open_tag}- the ADS team</p> '''.format(open_tag=open_tag) | ||
|
||
-The ADS team''' | ||
msg_html = html_template.format(msg=msg,email_address='''{email_address}''') | ||
subject = "[ADS] An email change has been requested" |
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