Add e-mail authorization to the repository notification flow. Also validates the creation of the other notification methods.

This commit is contained in:
Joseph Schorr 2014-07-28 14:58:12 -04:00
parent 56fec63fcd
commit 34fc279092
15 changed files with 483 additions and 34 deletions

View file

@ -57,6 +57,14 @@ Thanks and have a great day!<br>
"""
AUTH_FORREPO_MESSAGE = """
A request has been made to send notifications to this email address for the <a href="https://quay.io">Quay.io</a> repository <a href="https://quay.io/repository/%s/%s">%s/%s</a>.
<br>
To confirm this email address, please click the following link:<br>
<a href="https://quay.io/authrepoemail?code=%s">https://quay.io/authrepoemail?code=%s</a>
"""
SUBSCRIPTION_CHANGE_TITLE = 'Subscription Change - {0} {1}'
@ -76,6 +84,14 @@ def send_confirmation_email(username, email, token):
mail.send(msg)
def send_repo_authorization_email(namespace, repository, email, token):
msg = Message('Quay.io Notification: Please confirm your email.',
sender='support@quay.io', # Why do I need this?
recipients=[email])
msg.html = AUTH_FORREPO_MESSAGE % (namespace, repository, namespace, repository, token, token)
mail.send(msg)
def send_recovery_email(email, token):
msg = Message('Quay.io account recovery.',
sender='support@quay.io', # Why do I need this?