From 76b50cedd28528ce9d97f6451912130adfce549a Mon Sep 17 00:00:00 2001 From: Jason McBrayer Date: Tue, 9 Jul 2019 19:52:50 -0400 Subject: [PATCH] Redirect gab users to a configurable URL rather than logging them in. The default URL is "Never Gonna Give You Up" on invidio.us. --- brutaldon/settings.py | 3 +++ brutaldon/views.py | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/brutaldon/settings.py b/brutaldon/settings.py index 77854a9..3d571e2 100644 --- a/brutaldon/settings.py +++ b/brutaldon/settings.py @@ -199,5 +199,8 @@ SESSION_SERIALIZER = "django.contrib.sessions.serializers.PickleSerializer" # URL to redirect users to when not logged in ANONYMOUS_HOME_URL = "about" +# URL to redirect gab users to +GAB_RICKROLL_URL = "https://invidio.us/watch?v=dQw4w9WgXcQ" + # Version number displayed on about page BRUTALDON_VERSION = "2.12.1" diff --git a/brutaldon/views.py b/brutaldon/views.py index 9db84b0..beb9b13 100644 --- a/brutaldon/views.py +++ b/brutaldon/views.py @@ -352,6 +352,8 @@ def login(request): redirect_uris = request.build_absolute_uri(reverse("oauth_callback")) if form.is_valid(): api_base_url = form.cleaned_data["instance"] + if "gab.com" in api_base_url: + return redirect(django_settings.GAB_RICKROLL_URL) tmp_base = parse.urlparse(api_base_url.lower()) if tmp_base.netloc == "": api_base_url = parse.urlunparse( @@ -461,6 +463,8 @@ def old_login(request): form = LoginForm(request.POST) if form.is_valid(): api_base_url = form.cleaned_data["instance"] + if "gab.com" in api_base_url: + return redirect(django_settings.GAB_RICKROLL_URL) tmp_base = parse.urlparse(api_base_url.lower()) if tmp_base.netloc == "": api_base_url = parse.urlunparse(