mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-23 15:57:23 -04:00
Prevent duplicate domains
This commit is contained in:
@@ -1,3 +1,5 @@
|
|||||||
|
from collections import OrderedDict
|
||||||
|
|
||||||
from flask import flash, redirect, render_template, request, session, url_for
|
from flask import flash, redirect, render_template, request, session, url_for
|
||||||
from flask_login import current_user, login_required
|
from flask_login import current_user, login_required
|
||||||
from notifications_python_client.errors import HTTPError
|
from notifications_python_client.errors import HTTPError
|
||||||
@@ -416,7 +418,10 @@ def edit_organisation_domains(org_id):
|
|||||||
if form.validate_on_submit():
|
if form.validate_on_submit():
|
||||||
organisations_client.update_organisation(
|
organisations_client.update_organisation(
|
||||||
org_id,
|
org_id,
|
||||||
domains=list(filter(None, form.domains.data)),
|
domains=list(OrderedDict.fromkeys(
|
||||||
|
domain.lower()
|
||||||
|
for domain in filter(None, form.domains.data)
|
||||||
|
)),
|
||||||
)
|
)
|
||||||
return redirect(url_for('.organisation_settings', org_id=org_id))
|
return redirect(url_for('.organisation_settings', org_id=org_id))
|
||||||
|
|
||||||
|
|||||||
@@ -736,6 +736,8 @@ def test_view_organisation_domains(
|
|||||||
(
|
(
|
||||||
{
|
{
|
||||||
'domains-0': 'example.gov.uk',
|
'domains-0': 'example.gov.uk',
|
||||||
|
'domains-2': 'example.gov.uk',
|
||||||
|
'domains-3': 'EXAMPLE.GOV.UK',
|
||||||
'domains-5': 'test.gov.uk',
|
'domains-5': 'test.gov.uk',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user