mirror of
https://github.com/GSA/notifications-api.git
synced 2025-12-20 07:21:13 -05:00
Use GOV.UK Notify service to send the forgot password email link using the template to create the message.
This commit is contained in:
@@ -217,11 +217,20 @@ def send_user_reset_password():
|
||||
|
||||
user_to_send_to = get_user_by_email(email['email'])
|
||||
|
||||
reset_password_message = {'to': user_to_send_to.email_address,
|
||||
'name': user_to_send_to.name,
|
||||
'reset_password_url': _create_reset_password_url(user_to_send_to.email_address)}
|
||||
|
||||
email_reset_password.apply_async([encryption.encrypt(reset_password_message)], queue='email-reset-password')
|
||||
template = dao_get_template_by_id(current_app.config['PASSWORD_RESET_TEMPLATE_ID'])
|
||||
message = {
|
||||
'template': str(template.id),
|
||||
'template_version': template.version,
|
||||
'to': user_to_send_to.email_address,
|
||||
'personalisation': {
|
||||
'user_name': user_to_send_to.name,
|
||||
'url': _create_verification_url(user_to_send_to, _create_reset_password_url(user_to_send_to.email_address))
|
||||
}
|
||||
}
|
||||
send_email.apply_async([current_app.config['NOTIFY_SERVICE_ID'],
|
||||
str(uuid.uuid4()),
|
||||
encryption.encrypt(message),
|
||||
datetime.utcnow().strftime(DATETIME_FORMAT)], queue='email-reset-password')
|
||||
|
||||
return jsonify({}), 204
|
||||
|
||||
|
||||
Reference in New Issue
Block a user