mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-02-05 10:53:28 -05:00
Slight changes to match new API features:
- get user now throws a 404 so handle that - making a service now needs one user not many to create
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
from datetime import datetime
|
||||
from notifications_python_client import HTTPError
|
||||
|
||||
from sqlalchemy.orm import load_only
|
||||
|
||||
@@ -47,9 +48,15 @@ def activate_user(user):
|
||||
|
||||
|
||||
def is_email_unique(email_address):
|
||||
if user_api_client.get_user_by_email(email_address):
|
||||
return False
|
||||
return True
|
||||
try:
|
||||
if user_api_client.get_user_by_email(email_address):
|
||||
return False
|
||||
return True
|
||||
except HTTPError as ex:
|
||||
if ex.status_code == 404:
|
||||
return True
|
||||
else:
|
||||
raise ex
|
||||
|
||||
|
||||
def request_password_reset(user):
|
||||
|
||||
@@ -26,7 +26,6 @@ def register():
|
||||
return redirect(url_for('main.choose_service'))
|
||||
|
||||
form = RegisterUserForm()
|
||||
|
||||
if form.validate_on_submit():
|
||||
if users_dao.is_email_unique(form.email_address.data):
|
||||
try:
|
||||
|
||||
@@ -24,7 +24,7 @@ class NotificationsAdminAPIClient(NotificationsAPIClient):
|
||||
"name": service_name,
|
||||
"active": active,
|
||||
"limit": limit,
|
||||
"users": [user_id],
|
||||
"user_id": user_id,
|
||||
"restricted": restricted
|
||||
}
|
||||
return self.post("/service", data)
|
||||
|
||||
Reference in New Issue
Block a user