Redirect gab users to a configurable URL rather than logging them in.

The default URL is "Never Gonna Give You Up" on invidio.us.
This commit is contained in:
Jason McBrayer 2019-07-09 19:52:50 -04:00
parent afc62c51e3
commit 76b50cedd2
2 changed files with 7 additions and 0 deletions

View File

@ -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"

View File

@ -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(