mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-09-07 19:28:25 -04:00
Admin app settings to save reply to email address for service.
This commit is contained in:
@@ -314,3 +314,7 @@ class RequestToGoLiveForm(Form):
|
||||
|
||||
class ProviderForm(Form):
|
||||
priority = IntegerField('Priority', [validators.NumberRange(min=1, max=100, message="Must be between 1 and 100")])
|
||||
|
||||
|
||||
class ServiceReplyToEmailFrom(Form):
|
||||
email_address = email_address()
|
||||
|
||||
@@ -19,7 +19,12 @@ from notifications_python_client.errors import HTTPError
|
||||
from app import service_api_client
|
||||
from app.main import main
|
||||
from app.utils import user_has_permissions, email_safe
|
||||
from app.main.forms import ConfirmPasswordForm, ServiceNameForm, RequestToGoLiveForm
|
||||
from app.main.forms import (
|
||||
ConfirmPasswordForm,
|
||||
ServiceNameForm,
|
||||
RequestToGoLiveForm,
|
||||
ServiceReplyToEmailFrom
|
||||
)
|
||||
from app import user_api_client
|
||||
from app import current_service
|
||||
|
||||
@@ -217,3 +222,26 @@ def service_delete_confirm(service_id):
|
||||
heading='Delete this service from Notify',
|
||||
destructive=True,
|
||||
form=form)
|
||||
|
||||
|
||||
@main.route("/services/<service_id>/service-settings/set-reply-to-email", methods=['GET', 'POST'])
|
||||
@login_required
|
||||
@user_has_permissions('manage_settings', admin_override=True)
|
||||
def service_set_reply_to_email(service_id):
|
||||
form = ServiceReplyToEmailFrom()
|
||||
if form.validate_on_submit():
|
||||
message = 'Reply to email set to {}'.format(form.email_address.data)
|
||||
service_api_client.update_service(
|
||||
current_service['id'],
|
||||
current_service['name'],
|
||||
current_service['active'],
|
||||
current_service['message_limit'],
|
||||
current_service['restricted'],
|
||||
current_service['users'],
|
||||
current_service['email_from'],
|
||||
reply_to_email_address=form.email_address.data)
|
||||
flash(message, 'default_with_tick')
|
||||
return redirect(url_for('.service_settings', service_id=service_id))
|
||||
return render_template(
|
||||
'views/service-settings/set-reply-to-email.html',
|
||||
form=form)
|
||||
|
||||
@@ -62,7 +62,8 @@ class ServiceAPIClient(NotificationsAPIClient):
|
||||
message_limit,
|
||||
restricted,
|
||||
users,
|
||||
email_from):
|
||||
email_from,
|
||||
reply_to_email_address=None):
|
||||
"""
|
||||
Update a service.
|
||||
"""
|
||||
@@ -73,7 +74,8 @@ class ServiceAPIClient(NotificationsAPIClient):
|
||||
"message_limit": message_limit,
|
||||
"restricted": restricted,
|
||||
"users": users,
|
||||
"email_from": email_from
|
||||
"email_from": email_from,
|
||||
"reply_to_email_address": reply_to_email_address
|
||||
}
|
||||
_attach_current_user(data)
|
||||
endpoint = "/service/{0}".format(service_id)
|
||||
|
||||
@@ -14,6 +14,10 @@
|
||||
'title': 'Change your service name',
|
||||
'link': url_for('.service_name_change', service_id=current_service.id)
|
||||
},
|
||||
{
|
||||
'title': 'Set email reply to address',
|
||||
'link': url_for('.service_set_reply_to_email', service_id=current_service.id)
|
||||
},
|
||||
{
|
||||
'title': 'Request to go live and turn off trial mode',
|
||||
'link': url_for('.service_request_to_go_live', service_id=current_service.id),
|
||||
|
||||
28
app/templates/views/service-settings/set-reply-to-email.html
Normal file
28
app/templates/views/service-settings/set-reply-to-email.html
Normal file
@@ -0,0 +1,28 @@
|
||||
{% extends "withnav_template.html" %}
|
||||
{% from "components/textbox.html" import textbox %}
|
||||
{% from "components/page-footer.html" import page_footer %}
|
||||
|
||||
{% block page_title %}
|
||||
Request to go live – GOV.UK Notify
|
||||
{% endblock %}
|
||||
|
||||
{% block maincolumn_content %}
|
||||
|
||||
<div class="grid-row">
|
||||
<div class="column-three-quarters">
|
||||
<h1 class="heading-large">Set email reply to address</h1>
|
||||
<form method="post">
|
||||
{{ textbox(
|
||||
form.email_address,
|
||||
width='1-1',
|
||||
safe_error_message=True
|
||||
) }}
|
||||
{{ page_footer(
|
||||
'Save',
|
||||
back_link=url_for('.service_settings', service_id=current_service.id)
|
||||
) }}
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% endblock %}
|
||||
Reference in New Issue
Block a user