ftp set stuff
This commit is contained in:
@@ -33,7 +33,8 @@ allowed_paths = [
|
||||
'/rowers/me/gdpr-optin-confirm'
|
||||
'/rowers/exportallworkouts/',
|
||||
'/rowers/exportallworkouts',
|
||||
'/rowers/survey/'
|
||||
'/rowers/survey/',
|
||||
'/rowers/me/prefs/'
|
||||
]
|
||||
|
||||
|
||||
@@ -58,6 +59,26 @@ class SurveyMiddleWare(object):
|
||||
|
||||
return response
|
||||
|
||||
class FTPMiddleWare(object):
|
||||
def __init__(self, get_response):
|
||||
self.get_response = get_response
|
||||
|
||||
def __call__(self, request):
|
||||
if request.user.is_authenticated and request.path not in allowed_paths:
|
||||
r = getrower(request.user)
|
||||
nexturl = request.path
|
||||
if 'ftp' in nexturl: # pragma: no cover
|
||||
nexturl = '/rowers/me/prefs/'
|
||||
mustsetftp = not r.ftpset
|
||||
if mustsetftp: # pragma: no cover
|
||||
return redirect(
|
||||
'/rowers/me/prefs/?next=%s' % nexturl
|
||||
)
|
||||
|
||||
response = self.get_response(request)
|
||||
|
||||
return response
|
||||
|
||||
|
||||
class GDPRMiddleWare(object):
|
||||
def __init__(self, get_response):
|
||||
|
||||
Reference in New Issue
Block a user