mirror of
https://github.com/GSA/notifications-api.git
synced 2026-09-05 16:28:24 -04:00
Merge pull request #420 from alphagov/use-notify-to-send-email-verification-links
Use notify to send email verification links
This commit is contained in:
@@ -469,27 +469,6 @@ def registration_verification_template(name, url):
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@notify_celery.task(name='email-registration-verification')
|
|
||||||
def email_registration_verification(encrypted_verification_message):
|
|
||||||
provider = provider_to_use('email', 'email-reset-password')
|
|
||||||
|
|
||||||
verification_message = encryption.decrypt(encrypted_verification_message)
|
|
||||||
try:
|
|
||||||
email_from = '"GOV.UK Notify" <{}>'.format(
|
|
||||||
current_app.config['VERIFY_CODE_FROM_EMAIL_ADDRESS']
|
|
||||||
)
|
|
||||||
provider.send_email(
|
|
||||||
email_from,
|
|
||||||
verification_message['to'],
|
|
||||||
"Confirm GOV.UK Notify registration",
|
|
||||||
registration_verification_template(
|
|
||||||
name=verification_message['name'],
|
|
||||||
url=verification_message['url'])
|
|
||||||
)
|
|
||||||
except EmailClientException as e:
|
|
||||||
current_app.logger.exception(e)
|
|
||||||
|
|
||||||
|
|
||||||
def service_allowed_to_send_to(recipient, service):
|
def service_allowed_to_send_to(recipient, service):
|
||||||
if not service.restricted:
|
if not service.restricted:
|
||||||
return True
|
return True
|
||||||
|
|||||||
@@ -387,7 +387,6 @@ def send_notification(notification_type):
|
|||||||
send_email.apply_async((
|
send_email.apply_async((
|
||||||
service_id,
|
service_id,
|
||||||
notification_id,
|
notification_id,
|
||||||
'',
|
|
||||||
encryption.encrypt(notification),
|
encryption.encrypt(notification),
|
||||||
datetime.utcnow().strftime(DATETIME_FORMAT)
|
datetime.utcnow().strftime(DATETIME_FORMAT)
|
||||||
), queue='email')
|
), queue='email')
|
||||||
|
|||||||
@@ -1003,7 +1003,6 @@ def test_should_allow_valid_email_notification(notify_api, sample_email_template
|
|||||||
app.celery.tasks.send_email.apply_async.assert_called_once_with(
|
app.celery.tasks.send_email.apply_async.assert_called_once_with(
|
||||||
(str(sample_email_template.service_id),
|
(str(sample_email_template.service_id),
|
||||||
notification_id,
|
notification_id,
|
||||||
"",
|
|
||||||
"something_encrypted",
|
"something_encrypted",
|
||||||
"2016-01-01T11:09:00.061258"),
|
"2016-01-01T11:09:00.061258"),
|
||||||
queue="email"
|
queue="email"
|
||||||
|
|||||||
Reference in New Issue
Block a user