Add new email template for the GOV.UK Notify service, to send an email to users that register with the same email address.

Add a new endpoint to send the email.
This commit is contained in:
Rebecca Law
2016-07-07 17:23:07 +01:00
parent 55adc9239f
commit 36ecdca04c
5 changed files with 149 additions and 0 deletions

View File

@@ -0,0 +1,56 @@
"""empty message
Revision ID: 0041_email_template
Revises: 0040_adjust_mmg_provider_rate
Create Date: 2016-07-07 16:02:06.241769
"""
# revision identifiers, used by Alembic.
from datetime import datetime
revision = '0041_email_template'
down_revision = '0040_adjust_mmg_provider_rate'
from alembic import op
user_id = '6af522d0-2915-4e52-83a3-3690455a5fe6'
service_id = 'd6aa2c68-a2d9-4437-ab19-3ae8eb202553'
def upgrade():
template_history_insert = """INSERT INTO templates_history (id, name, template_type, created_at,
content, archived, service_id,
subject, created_by_id, version)
VALUES ('{}', '{}', '{}', '{}', '{}', False, '{}', '{}', '{}', 1)
"""
template_insert = """INSERT INTO templates (id, name, template_type, created_at,
content, archived, service_id, subject, created_by_id, version)
VALUES ('{}', '{}', '{}', '{}', '{}', False, '{}', '{}', '{}', 1)
"""
content = """You already have a GOV.UK Notify account with this email address.
Sign in here: ((signin_url))
If youve forgotten your password, you can reset it here: ((forgot_password_url))
If you didnt try to register for a GOV.UK Notify account recently, please let us know here: ((feedback_url))"""
op.get_bind()
op.execute(template_history_insert.format('0880fbb1-a0c6-46f0-9a8e-36c986381ceb',
'Your GOV.UK Notify account', 'email',
datetime.utcnow(), content, service_id,
'Your GOV.UK Notify account', user_id))
op.execute(
template_insert.format('0880fbb1-a0c6-46f0-9a8e-36c986381ceb', 'Your GOV.UK Notify account', 'email',
datetime.utcnow(), content, service_id,
'Your GOV.UK Notify account', user_id))
def downgrade():
op.execute("delete from notifications where template_id = '0880fbb1-a0c6-46f0-9a8e-36c986381ceb'")
op.execute("delete from jobs where template_id = '0880fbb1-a0c6-46f0-9a8e-36c986381ceb'")
op.execute("delete from template_statistics where template_id = '0880fbb1-a0c6-46f0-9a8e-36c986381ceb'")
op.execute("delete from templates_history where id = '0880fbb1-a0c6-46f0-9a8e-36c986381ceb'")
op.execute("delete from templates where id = '0880fbb1-a0c6-46f0-9a8e-36c986381ceb'")