Fix #1522 -- Login button redirects to authentication url with… (#1525)

This commit is contained in:
Maico Timmerman
2019-12-16 10:42:51 +01:00
committed by Raphael Michel
parent 488ee19b11
commit 28242e52aa
2 changed files with 9 additions and 1 deletions

View File

@@ -32,7 +32,8 @@ class LoginForm(forms.Form):
for k, f in backend.login_form_fields.items(): for k, f in backend.login_form_fields.items():
self.fields[k] = f self.fields[k] = f
if not settings.PRETIX_LONG_SESSIONS: # Authentication backends which use urls cannot have long sessions.
if not settings.PRETIX_LONG_SESSIONS or backend.url:
del self.fields['keep_logged_in'] del self.fields['keep_logged_in']
else: else:
self.fields.move_to_end('keep_logged_in') self.fields.move_to_end('keep_logged_in')

View File

@@ -22,9 +22,16 @@
{% csrf_token %} {% csrf_token %}
{% bootstrap_form form %} {% bootstrap_form form %}
<div class="form-group buttons"> <div class="form-group buttons">
{% if backend.login_form_fields %}
<button type="submit" class="btn btn-primary btn-block"> <button type="submit" class="btn btn-primary btn-block">
{% trans "Log in" %} {% trans "Log in" %}
</button> </button>
{% endif %}
{% if backend.url %}
<a href="{{ backend.url }}" class="btn btn-primary btn-block">
{{ backend.verbose_name }}
</a>
{% endif %}
{% if backend.identifier == "native" %} {% if backend.identifier == "native" %}
{% if can_reset %} {% if can_reset %}
<a href="{% url "control:auth.forgot" %}" class="btn btn-link btn-block"> <a href="{% url "control:auth.forgot" %}" class="btn btn-link btn-block">