Merge pull request #25338 from open-craft/nizar/xframe_allow_whitelist
Sets default X-Frame-Options for login and registration forms to environment setting
This commit is contained in:
@@ -17,13 +17,13 @@ from common.djangoapps.third_party_auth.provider import Registry
|
||||
def xframe_allow_whitelisted(view_func):
|
||||
"""
|
||||
Modifies a view function so that its response has the X-Frame-Options HTTP header
|
||||
set to 'DENY' if the request HTTP referrer is not from a whitelisted hostname.
|
||||
set to `settings.X_FRAME_OPTIONS` if the request HTTP referrer is not from a whitelisted hostname.
|
||||
"""
|
||||
|
||||
def wrapped_view(request, *args, **kwargs):
|
||||
""" Modify the response with the correct X-Frame-Options. """
|
||||
resp = view_func(request, *args, **kwargs)
|
||||
x_frame_option = 'DENY'
|
||||
x_frame_option = settings.X_FRAME_OPTIONS
|
||||
if settings.FEATURES['ENABLE_THIRD_PARTY_AUTH']:
|
||||
referer = request.META.get('HTTP_REFERER')
|
||||
if referer is not None:
|
||||
|
||||
Reference in New Issue
Block a user