Skip to content

Commit 6c7045c

Browse files
committed
Backup
1 parent 12bf3fe commit 6c7045c

File tree

3 files changed

+9
-2
lines changed

3 files changed

+9
-2
lines changed

framework/auth/views.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1200,7 +1200,7 @@ def validate_campaign(campaign):
12001200
def validate_next_url(next_url):
12011201
"""
12021202
Non-view helper function that checks `next_url`.
1203-
Only allow redirects which are relative root or full domain (CAS, OSF and MFR).
1203+
Only allow redirects which are relative root or full domain (CAS, OSF, MFR and Angular frontend).
12041204
Disallows external redirects.
12051205
12061206
:param next_url: the next url to check
@@ -1212,7 +1212,7 @@ def validate_next_url(next_url):
12121212
if next_url.startswith('//'):
12131213
return False
12141214

1215-
# only OSF, MFR, CAS and Branded Preprints domains are allowed
1215+
# only OSF, MFR, CAS, Branded Preprints, and Angular frontend domains are allowed
12161216
if next_url[0] == '/' or next_url.startswith(settings.DOMAIN):
12171217
# OSF
12181218
return True
@@ -1226,6 +1226,8 @@ def validate_next_url(next_url):
12261226
# Branded Preprints Phase 2
12271227
if next_url.startswith(url):
12281228
return True
1229+
if settings.LOCAL_ANGULAR_URL and next_url.startswith(settings.LOCAL_ANGULAR_URL):
1230+
return True
12291231

12301232
return False
12311233

website/settings/defaults.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,9 @@ def parent_dir(path):
103103
EXTERNAL_EMBER_SERVER_TIMEOUT = 3.05
104104
EXTERNAL_EMBER_APPS = {}
105105

106+
# Local Angular frontend URL (used for validating next_url redirects during login/logout)
107+
LOCAL_ANGULAR_URL = ''
108+
106109
LOG_PATH = os.path.join(APP_PATH, 'logs')
107110
TEMPLATES_PATH = os.path.join(BASE_PATH, 'templates')
108111

website/settings/local-dist.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@
5353
},
5454
}
5555

56+
LOCAL_ANGULAR_URL = 'http://localhost:4200'
57+
5658
SEARCH_ENGINE = 'elastic'
5759
ELASTIC_TIMEOUT = 10
5860

0 commit comments

Comments
 (0)