Correct template id for email verification template in the history table.

Correct personalisation name when sending registration message.
This commit is contained in:
Rebecca Law
2016-06-13 11:29:07 +01:00
parent 877fd6fdc4
commit ea80596e73
2 changed files with 41 additions and 1 deletions

View File

@@ -163,7 +163,7 @@ def send_user_email_verification(user_id):
'template_version': template.version,
'to': user_to_send_to.email_address,
'personalisation': {
'user_name': user_to_send_to.name,
'name': user_to_send_to.name,
'url': _create_verification_url(user_to_send_to, secret_code)
}
}

View File

@@ -0,0 +1,40 @@
"""empty message
Revision ID: 0028_fix_reg_template_history
Revises: 0027_update_provider_rates
Create Date: 2016-06-13 11:04:15.888017
"""
# revision identifiers, used by Alembic.
from datetime import datetime
revision = '0028_fix_reg_template_history'
down_revision = '0027_update_provider_rates'
from alembic import op
import sqlalchemy as sa
service_id = 'd6aa2c68-a2d9-4437-ab19-3ae8eb202553'
user_id= '6af522d0-2915-4e52-83a3-3690455a5fe6'
def upgrade():
op.get_bind()
op.execute("delete from templates_history where name = 'Notify email verification code'")
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)
"""
email_verification_content = \
"""Hi ((name)),\n\nTo complete your registration for GOV.UK Notify please click the link below\n\n((url))"""
op.execute(template_history_insert.format('ece42649-22a8-4d06-b87f-d52d5d3f0a27',
'Notify email verification code', 'email',
datetime.utcnow(), email_verification_content, service_id,
'Confirm GOV.UK Notify registration', user_id))
def downgrade():
### commands auto generated by Alembic - please adjust! ###
pass
### end Alembic commands ###