aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBobby <[email protected]>2022-10-10 12:32:58 -0400
committerBobby <[email protected]>2022-10-10 12:32:58 -0400
commit7886f34fe3953a963e6af16a82712147702bf7d8 (patch)
tree351d3227aa8ed2d4c9a3b0ae73e0d7957b23b3e7
parentfc2a953512ec805ae058d465dacb9d73c2711eed (diff)
downloadthatcomputerscientist-7886f34fe3953a963e6af16a82712147702bf7d8.tar.xz
thatcomputerscientist-7886f34fe3953a963e6af16a82712147702bf7d8.zip
Revert "SSL redirect on subdomain"
This reverts commit 5d11cb12fc7a55ac7d5a541e608ef00a22dad4d9.
-rw-r--r--thatcomputerscientist/settings.py1
-rw-r--r--thatcomputerscientist/templatetags/subdomainurls.py6
-rw-r--r--users/views.py3
3 files changed, 3 insertions, 7 deletions
diff --git a/thatcomputerscientist/settings.py b/thatcomputerscientist/settings.py
index 35284fe0..d0188ea6 100644
--- a/thatcomputerscientist/settings.py
+++ b/thatcomputerscientist/settings.py
@@ -35,7 +35,6 @@ HOSTS = [".vcap.me"] if os.getenv('ENVIRONMENT') == 'development' else [".thatco
CSRF_TRUSTED_ORIGINS = ['http://*.localhost', 'https://*.thatcomputerscientist.com', 'https://*.thatcomputerscientist.fly.dev/', 'http://*.vcap.me']
SESSION_COOKIE_DOMAIN = ".vcap.me" if os.getenv('ENVIRONMENT') == 'development' else ".thatcomputerscientist.com"
DOMAIN_NAME = "vcap.me" if os.getenv('ENVIRONMENT') == 'development' else "thatcomputerscientist.com"
-SECURE_SSL_REDIRECT = False if os.getenv('ENVIRONMENT') == 'development' else True
# Application definition
diff --git a/thatcomputerscientist/templatetags/subdomainurls.py b/thatcomputerscientist/templatetags/subdomainurls.py
index fa8af0b0..cb7b2554 100644
--- a/thatcomputerscientist/templatetags/subdomainurls.py
+++ b/thatcomputerscientist/templatetags/subdomainurls.py
@@ -13,16 +13,14 @@ def subdomain_url(view_name, subdomain = None, referrer = None, *args, **kwargs)
return reverse(view_name, args=args, kwargs=kwargs)
if referrer:
- return '{}://{}{}{}?referrer={}'.format(
- 'https' if settings.SECURE_SSL_REDIRECT else 'http',
+ return '//{}{}{}?referrer={}'.format(
subdomain,
settings.HOSTS[0],
reverse(view_name, args=args, kwargs=kwargs),
referrer
)
- return '{}://{}{}{}'.format(
- 'https' if settings.SECURE_SSL_REDIRECT else 'http',
+ return '//{}{}{}'.format(
subdomain,
settings.HOSTS[0],
reverse(view_name, args=args, kwargs=kwargs)
diff --git a/users/views.py b/users/views.py
index b0c2126e..5a7757a4 100644
--- a/users/views.py
+++ b/users/views.py
@@ -20,8 +20,7 @@ def get_ref(request):
try:
referrer = request.META.get('QUERY_STRING').split('referrer=')[1]
except:
- # Raise a unauthorized error if the referrer is not set
- return HttpResponse('Unauthorized', status=401)
+ referrer = request.META.get('HTTP_REFERER')
if '?' in referrer:
referrer = referrer.split('?')[0]
return referrer