Commit 00c2f83c authored by Michal Čihař's avatar Michal Čihař

Do not automatically redirect for email backend

Signed-off-by: default avatarMichal Čihař <michal@cihar.com>
parent 7c9cae9d
...@@ -375,7 +375,7 @@ def weblate_login(request): ...@@ -375,7 +375,7 @@ def weblate_login(request):
# Redirect if there is only one backend # Redirect if there is only one backend
auth_backends = load_backends(BACKENDS).keys() auth_backends = load_backends(BACKENDS).keys()
if len(auth_backends) == 1: if len(auth_backends) == 1 and auth_backends[0] != 'email':
return redirect('social:begin', auth_backends[0]) return redirect('social:begin', auth_backends[0])
return auth_views.login( return auth_views.login(
...@@ -420,11 +420,13 @@ def register(request): ...@@ -420,11 +420,13 @@ def register(request):
else: else:
form = form_class() form = form_class()
backends = set(load_backends(BACKENDS).keys()) backends = load_backends(BACKENDS).keys()
# Redirect if there is only one backend # Redirect if there is only one backend
if len(backends) == 1: if len(backends) == 1 and backends[0] != 'email':
return redirect('social:begin', backends.pop()) return redirect('social:begin', backends[0])
backends = set(backends)
return render( return render(
request, request,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment