mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-24 16:24:08 -04:00
Refactor government user check onto model
This commit is contained in:
@@ -75,7 +75,7 @@ def add_service():
|
||||
service_id = _add_invited_user_to_service(invited_user)
|
||||
return redirect(url_for('main.service_dashboard', service_id=service_id))
|
||||
|
||||
if not is_gov_user(current_user.email_address):
|
||||
if not current_user.is_gov_user:
|
||||
abort(403)
|
||||
|
||||
form = CreateServiceForm()
|
||||
|
||||
@@ -26,7 +26,7 @@ def choose_account():
|
||||
'views/choose-account.html',
|
||||
organisations=orgs_and_services['organisations'],
|
||||
services_without_organisations=orgs_and_services['services_without_organisations'],
|
||||
can_add_service=is_gov_user(current_user.email_address)
|
||||
can_add_service=current_user.is_gov_user,
|
||||
)
|
||||
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ NEW_MOBILE_PASSWORD_CONFIRMED = 'new-mob-password-confirmed'
|
||||
def user_profile():
|
||||
return render_template(
|
||||
'views/user-profile.html',
|
||||
can_see_edit=is_gov_user(current_user.email_address)
|
||||
can_see_edit=current_user.is_gov_user,
|
||||
)
|
||||
|
||||
|
||||
@@ -58,7 +58,7 @@ def user_profile_name():
|
||||
@login_required
|
||||
def user_profile_email():
|
||||
|
||||
if not is_gov_user(current_user.email_address):
|
||||
if not current_user.is_gov_user:
|
||||
abort(403)
|
||||
|
||||
def _is_email_already_in_use(email):
|
||||
|
||||
Reference in New Issue
Block a user