def send_user_reset_password(): email, errors = email_data_request_schema.load(request.get_json()) user_to_send_to = get_user_by_email(email['email']) 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_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='notify') return jsonify({}), 204
def send_already_registered_email(user_id): to, errors = email_data_request_schema.load(request.get_json()) template = dao_get_template_by_id(current_app.config['ALREADY_REGISTERED_EMAIL_TEMPLATE_ID']) message = { 'template': str(template.id), 'template_version': template.version, 'to': to['email'], 'personalisation': { 'signin_url': current_app.config['ADMIN_BASE_URL'] + '/sign-in', 'forgot_password_url': current_app.config['ADMIN_BASE_URL'] + '/forgot-password', 'feedback_url': current_app.config['ADMIN_BASE_URL'] + '/feedback' } } send_email.apply_async(( current_app.config['NOTIFY_SERVICE_ID'], str(uuid.uuid4()), encryption.encrypt(message), datetime.utcnow().strftime(DATETIME_FORMAT) ), queue='notify') return jsonify({}), 204