Waiting page shows correct messages

This commit is contained in:
Pea Tyczynska
2019-05-13 10:17:20 +01:00
parent d70afddf51
commit 45ac0d7812
5 changed files with 72 additions and 4 deletions

View File

@@ -77,6 +77,8 @@ class Config(object):
ASSET_DOMAIN = ''
ASSET_PATH = '/static/'
NOTIFY_SERVICE_ID = 'd6aa2c68-a2d9-4437-ab19-3ae8eb202553'
class Development(Config):
NOTIFY_LOG_PATH = 'application.log'

View File

@@ -422,8 +422,19 @@ def service_add_email_reply_to(service_id):
@login_required
@user_has_permissions('manage_service')
def verify_reply_to_address(service_id, notification_id):
notification = notification_api_client.get_notification(current_app.config["NOTIFY_SERVICE_ID"], notification_id)
verification_status = "pending"
if notification["status"] == "delivered":
verification_status = "success"
if notification["status"] in ["failed", "permanent-failure", "technical-failure", "temporary-failure"]:
verification_status = "failure"
# also include condition for when lots of time passes
return render_template(
'views/service-settings/email-reply-to/verify.html'
'views/service-settings/email-reply-to/verify.html',
reply_to_email_address=notification["to"],
service_id=service_id,
notification_id=notification_id,
verification_status=verification_status
)

View File

@@ -0,0 +1,35 @@
{% extends "withnav_template.html" %}
{% from "components/textbox.html" import textbox %}
{% from "components/checkbox.html" import checkbox %}
{% from "components/page-header.html" import page_header %}
{% from "components/page-footer.html" import page_footer %}
{% from "components/form.html" import form_wrapper %}
{% block service_page_title %}
Verifying your reply-to email address
{% endblock %}
{% block maincolumn_content %}
{{ page_header(
'Verifying your reply-to email address',
back_link=url_for('main.service_email_reply_to', service_id=current_service.id)
) }}
{% if verification_status == "pending" %}
<p>
We have sent a notification to {{ reply_to_email_address }} to check if it's a working email address.
</p>
<p>
Once we receive a delivery confirmation, we will update your list of reply-to email addresses.
</p>
<p>
<a href="{{ url_for('main.verify_reply_to_address', service_id=service_id, notification_id=notification_id) }}"">Refresh</a>
</p>
{% elif verification_status == "success" %}
{{ banner("Yay success! Your new reply-to email has been added ^__^", type='message', with_tick=True) }}
{% elif verification_status == "failure" %}
{{ banner("Sorry dawg, this email address doesn't seem to be working :d", type='dangerous') }}
{% endif %}
{% endblock %}