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:
parent
afc62c51e3
commit
76b50cedd2
|
@ -199,5 +199,8 @@ SESSION_SERIALIZER = "django.contrib.sessions.serializers.PickleSerializer"
|
||||||
# URL to redirect users to when not logged in
|
# URL to redirect users to when not logged in
|
||||||
ANONYMOUS_HOME_URL = "about"
|
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
|
# Version number displayed on about page
|
||||||
BRUTALDON_VERSION = "2.12.1"
|
BRUTALDON_VERSION = "2.12.1"
|
||||||
|
|
|
@ -352,6 +352,8 @@ def login(request):
|
||||||
redirect_uris = request.build_absolute_uri(reverse("oauth_callback"))
|
redirect_uris = request.build_absolute_uri(reverse("oauth_callback"))
|
||||||
if form.is_valid():
|
if form.is_valid():
|
||||||
api_base_url = form.cleaned_data["instance"]
|
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())
|
tmp_base = parse.urlparse(api_base_url.lower())
|
||||||
if tmp_base.netloc == "":
|
if tmp_base.netloc == "":
|
||||||
api_base_url = parse.urlunparse(
|
api_base_url = parse.urlunparse(
|
||||||
|
@ -461,6 +463,8 @@ def old_login(request):
|
||||||
form = LoginForm(request.POST)
|
form = LoginForm(request.POST)
|
||||||
if form.is_valid():
|
if form.is_valid():
|
||||||
api_base_url = form.cleaned_data["instance"]
|
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())
|
tmp_base = parse.urlparse(api_base_url.lower())
|
||||||
if tmp_base.netloc == "":
|
if tmp_base.netloc == "":
|
||||||
api_base_url = parse.urlunparse(
|
api_base_url = parse.urlunparse(
|
||||||
|
|
Loading…
Reference in New Issue