Permet de désactiver la connexion par mot de passe

This commit is contained in:
Tom Hubrecht 2021-02-23 23:32:44 +01:00
parent c2bacdd86d
commit f4ef5b909b
4 changed files with 19 additions and 9 deletions

View file

@ -1,3 +1,4 @@
LDAP_SERVER_URL = "ldaps://ldap.spi.ens.fr:636" LDAP_SERVER_URL = "ldaps://ldap.spi.ens.fr:636"
AUTHENS_USE_OLDCAS = True AUTHENS_USE_OLDCAS = True
AUTHENS_USE_PASSWORD = True
# TODO: CAS_SERVER_URL # TODO: CAS_SERVER_URL

View file

@ -10,9 +10,11 @@
<a class="big-button cas" href="{% url "authens:login.cas" %}?next={{ next| urlencode }}"> <a class="big-button cas" href="{% url "authens:login.cas" %}?next={{ next| urlencode }}">
{% trans "Clipper" %} {% trans "Clipper" %}
</a> </a>
{% if password %}
<a class="big-button exte" href="{% url "authens:login.pwd" %}?next={{ next| urlencode }}"> <a class="big-button exte" href="{% url "authens:login.pwd" %}?next={{ next| urlencode }}">
{% trans "Mot de passe" %} {% trans "Mot de passe" %}
</a> </a>
{% endif %}
{% if oldcas %} {% if oldcas %}
<a class="big-button oldcas" href="{% url "authens:login.oldcas" %}?next={{ next| urlencode }}"> <a class="big-button oldcas" href="{% url "authens:login.oldcas" %}?next={{ next| urlencode }}">
{% trans "Vieilleux" %} {% trans "Vieilleux" %}

View file

@ -7,8 +7,12 @@ app_name = "authens"
urlpatterns = [ urlpatterns = [
path("login/choose", views.LoginSwitchView.as_view(), name="login"), path("login/choose", views.LoginSwitchView.as_view(), name="login"),
path("login/cas", views.CASLoginView.as_view(), name="login.cas"), path("login/cas", views.CASLoginView.as_view(), name="login.cas"),
path("login/pwd", views.PasswordLoginView.as_view(), name="login.pwd"),
path("logout", views.LogoutView.as_view(), name="logout"), path("logout", views.LogoutView.as_view(), name="logout"),
]
if getattr(settings, "AUTHENS_USE_PASSWORD", default_conf.AUTHENS_USE_PASSWORD):
urlpatterns += [
path("login/pwd", views.PasswordLoginView.as_view(), name="login.pwd"),
path("reset/pwd", views.PasswordResetView.as_view(), name="reset.pwd"), path("reset/pwd", views.PasswordResetView.as_view(), name="reset.pwd"),
path( path(
"reset/pwd/<uidb64>/<token>/", "reset/pwd/<uidb64>/<token>/",
@ -18,6 +22,6 @@ urlpatterns = [
] ]
if getattr(settings, "AUTHENS_USE_OLDCAS", default_conf.AUTHENS_USE_OLDCAS): if getattr(settings, "AUTHENS_USE_OLDCAS", default_conf.AUTHENS_USE_OLDCAS):
urlpatterns += ( urlpatterns += [
path("login/oldcas", views.OldCASLoginView.as_view(), name="login.oldcas"), path("login/oldcas", views.OldCASLoginView.as_view(), name="login.oldcas"),
) ]

View file

@ -55,6 +55,9 @@ class LoginSwitchView(NextPageMixin, TemplateView):
"oldcas": getattr( "oldcas": getattr(
settings, "AUTHENS_USE_OLDCAS", default_conf.AUTHENS_USE_OLDCAS settings, "AUTHENS_USE_OLDCAS", default_conf.AUTHENS_USE_OLDCAS
), ),
"password": getattr(
settings, "AUTHENS_USE_PASSWORD", default_conf.AUTHENS_USE_PASSWORD
),
} }
) )
return ctx return ctx