diff --git a/app/config.py b/app/config.py index 549d060c6..59be8ad02 100644 --- a/app/config.py +++ b/app/config.py @@ -125,7 +125,8 @@ class Config(object): NOTIFY_USER_ID = '6af522d0-2915-4e52-83a3-3690455a5fe6' INVITATION_EMAIL_TEMPLATE_ID = '4f46df42-f795-4cc4-83bb-65ca312f49cc' SMS_CODE_TEMPLATE_ID = '36fb0730-6259-4da1-8a80-c8de22ad4246' - EMAIL_VERIFY_CODE_TEMPLATE_ID = 'ece42649-22a8-4d06-b87f-d52d5d3f0a27' + EMAIL_2FA_TEMPLATE_ID = '299726d2-dba6-42b8-8209-30e1d66ea164' + NEW_USER_EMAIL_VERIFICATION_TEMPLATE_ID = 'ece42649-22a8-4d06-b87f-d52d5d3f0a27' PASSWORD_RESET_TEMPLATE_ID = '474e9242-823b-4f99-813d-ed392e7f1201' ALREADY_REGISTERED_EMAIL_TEMPLATE_ID = '0880fbb1-a0c6-46f0-9a8e-36c986381ceb' CHANGE_EMAIL_CONFIRMATION_TEMPLATE_ID = 'eb4d9930-87ab-4aef-9bce-786762687884' diff --git a/app/user/rest.py b/app/user/rest.py index 285057225..68ca8d943 100644 --- a/app/user/rest.py +++ b/app/user/rest.py @@ -171,7 +171,7 @@ def send_user_email_code(user_id): create_user_code(user_to_send_to, uuid.uuid4(), EMAIL_TYPE) - template = dao_get_template_by_id(current_app.config['EMAIL_CODE_TEMPLATE_ID']) + template = dao_get_template_by_id(current_app.config['EMAIL_2FA_TEMPLATE_ID']) personalisation = {'url': _create_2fa_url(user_to_send_to)}, create_2fa_code(template, user_to_send_to.email_address, personalisation) @@ -238,13 +238,13 @@ def send_user_confirm_new_email(user_id): @user_blueprint.route('//email-verification', methods=['POST']) -def send_user_email_verification(user_id): +def send_new_user_email_verification(user_id): # when registering, we verify all users' email addresses using this function user_to_send_to = get_user_by_id(user_id=user_id) secret_code = create_secret_code() create_user_code(user_to_send_to, secret_code, 'email') - template = dao_get_template_by_id(current_app.config['EMAIL_VERIFY_CODE_TEMPLATE_ID']) + template = dao_get_template_by_id(current_app.config['NEW_USER_EMAIL_VERIFICATION_TEMPLATE_ID']) service = Service.query.get(current_app.config['NOTIFY_SERVICE_ID']) saved_notification = persist_notification( diff --git a/tests/app/conftest.py b/tests/app/conftest.py index e03b2b7dd..999e319c0 100644 --- a/tests/app/conftest.py +++ b/tests/app/conftest.py @@ -871,7 +871,7 @@ def email_verification_template(notify_db, return create_custom_template( service=service, user=user, - template_config_name='EMAIL_VERIFY_CODE_TEMPLATE_ID', + template_config_name='NEW_USER_EMAIL_VERIFICATION_TEMPLATE_ID', content='((user_name)) use ((url)) to complete registration', template_type='email' ) diff --git a/tests/app/user/test_rest_verify.py b/tests/app/user/test_rest_verify.py index 492a305b4..674f4cb4b 100644 --- a/tests/app/user/test_rest_verify.py +++ b/tests/app/user/test_rest_verify.py @@ -261,14 +261,14 @@ def test_send_sms_code_returns_204_when_too_many_codes_already_created(client, s assert VerifyCode.query.count() == 10 -def test_send_user_email_verification(client, - sample_user, - mocker, - email_verification_template): +def test_send_new_user_email_verification(client, + sample_user, + mocker, + email_verification_template): mocked = mocker.patch('app.celery.provider_tasks.deliver_email.apply_async') auth_header = create_authorization_header() resp = client.post( - url_for('user.send_user_email_verification', user_id=str(sample_user.id)), + url_for('user.send_new_user_email_verification', user_id=str(sample_user.id)), data=json.dumps({}), headers=[('Content-Type', 'application/json'), auth_header]) assert resp.status_code == 204 @@ -284,7 +284,7 @@ def test_send_email_verification_returns_404_for_bad_input_data(client, notify_d uuid_ = uuid.uuid4() auth_header = create_authorization_header() resp = client.post( - url_for('user.send_user_email_verification', user_id=uuid_), + url_for('user.send_new_user_email_verification', user_id=uuid_), data=json.dumps({}), headers=[('Content-Type', 'application/json'), auth_header]) assert resp.status_code == 404