mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-16 20:49:00 -04:00
when not logged in, redirect to sign-in
parts of the initial setup/login stages were throwing 500s if user not already in process (ie: user directly navigated to url): * /resend-email-verification * /text-not-received * /send-new-code * verify
This commit is contained in:
14
app/utils.py
14
app/utils.py
@@ -1,9 +1,9 @@
|
||||
import re
|
||||
import csv
|
||||
from io import BytesIO, StringIO
|
||||
from io import StringIO
|
||||
from os import path
|
||||
from functools import wraps
|
||||
from flask import (abort, session, request, url_for)
|
||||
from flask import (abort, session, request, redirect, url_for)
|
||||
import pyexcel
|
||||
import pyexcel.ext.io
|
||||
import pyexcel.ext.xls
|
||||
@@ -51,6 +51,16 @@ def user_has_permissions(*permissions, admin_override=False, any_=False):
|
||||
return wrap
|
||||
|
||||
|
||||
def redirect_to_sign_in(f):
|
||||
@wraps(f)
|
||||
def wrapped(*args, **kwargs):
|
||||
if 'user_details' not in session:
|
||||
return redirect(url_for('main.sign_in'))
|
||||
else:
|
||||
return f(*args, **kwargs)
|
||||
return wrapped
|
||||
|
||||
|
||||
def get_errors_for_csv(recipients, template_type):
|
||||
|
||||
errors = []
|
||||
|
||||
Reference in New Issue
Block a user