mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-07-31 11:49:58 -04:00
Let platform admins add or update service reply to email address
without the need for verification. This is for when the email takes too long to arrive and the service users cannot update it as a result. A more streamlined solution has been proposed where we could send a link in the verification email to the users and clicking that link would add/update reply-email-to address. That would require a bit more work so right now I am proposing this as a quick stop gap so that we don't have to go to the database manually to add the reply-to email address.
This commit is contained in:
@@ -511,22 +511,30 @@ def service_add_email_reply_to(service_id):
|
||||
first_email_address = current_service.count_email_reply_to_addresses == 0
|
||||
is_default = first_email_address if first_email_address else form.is_default.data
|
||||
if form.validate_on_submit():
|
||||
try:
|
||||
notification_id = service_api_client.verify_reply_to_email_address(
|
||||
service_id, form.email_address.data
|
||||
)["data"]["id"]
|
||||
except HTTPError as e:
|
||||
if e.status_code == 409:
|
||||
flash(e.message, 'error')
|
||||
return redirect(url_for('.service_email_reply_to', service_id=service_id))
|
||||
else:
|
||||
raise e
|
||||
return redirect(url_for(
|
||||
'.service_verify_reply_to_address',
|
||||
service_id=service_id,
|
||||
notification_id=notification_id,
|
||||
is_default=is_default
|
||||
))
|
||||
if current_user.platform_admin:
|
||||
service_api_client.add_reply_to_email_address(
|
||||
service_id,
|
||||
email_address=form.email_address.data,
|
||||
is_default=is_default
|
||||
)
|
||||
return redirect(url_for('.service_email_reply_to', service_id=service_id))
|
||||
else:
|
||||
try:
|
||||
notification_id = service_api_client.verify_reply_to_email_address(
|
||||
service_id, form.email_address.data
|
||||
)["data"]["id"]
|
||||
except HTTPError as e:
|
||||
if e.status_code == 409:
|
||||
flash(e.message, 'error')
|
||||
return redirect(url_for('.service_email_reply_to', service_id=service_id))
|
||||
else:
|
||||
raise e
|
||||
return redirect(url_for(
|
||||
'.service_verify_reply_to_address',
|
||||
service_id=service_id,
|
||||
notification_id=notification_id,
|
||||
is_default=is_default
|
||||
))
|
||||
|
||||
return render_template(
|
||||
'views/service-settings/email-reply-to/add.html',
|
||||
@@ -630,7 +638,7 @@ def service_edit_email_reply_to(service_id, reply_to_email_id):
|
||||
form.email_address.data = reply_to_email_address['email_address']
|
||||
form.is_default.data = reply_to_email_address['is_default']
|
||||
if form.validate_on_submit():
|
||||
if form.email_address.data == reply_to_email_address["email_address"]:
|
||||
if form.email_address.data == reply_to_email_address["email_address"] or current_user.platform_admin:
|
||||
service_api_client.update_reply_to_email_address(
|
||||
current_service.id,
|
||||
reply_to_email_id=reply_to_email_id,
|
||||
|
||||
Reference in New Issue
Block a user