diff --git a/authens/conf.py b/authens/conf.py index 94d8cf5..732b984 100644 --- a/authens/conf.py +++ b/authens/conf.py @@ -1,3 +1,4 @@ LDAP_SERVER_URL = "ldaps://ldap.spi.ens.fr:636" AUTHENS_USE_OLDCAS = True +AUTHENS_USE_PASSWORD = True # TODO: CAS_SERVER_URL diff --git a/authens/templates/authens/login_switch.html b/authens/templates/authens/login_switch.html index 3d05908..5e91f71 100644 --- a/authens/templates/authens/login_switch.html +++ b/authens/templates/authens/login_switch.html @@ -10,9 +10,11 @@ {% trans "Clipper" %} + {% if password %} {% trans "Mot de passe" %} + {% endif %} {% if oldcas %} {% trans "Vieilleux" %} diff --git a/authens/urls.py b/authens/urls.py index 18e2aee..2c3e8e6 100644 --- a/authens/urls.py +++ b/authens/urls.py @@ -7,17 +7,21 @@ app_name = "authens" urlpatterns = [ path("login/choose", views.LoginSwitchView.as_view(), name="login"), 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("reset/pwd", views.PasswordResetView.as_view(), name="reset.pwd"), - path( - "reset/pwd///", - views.PasswordResetConfirmView.as_view(), - name="reset.pwd.confirm", - ), ] +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.PasswordResetConfirmView.as_view(), + name="reset.pwd.confirm", + ), + ] + if getattr(settings, "AUTHENS_USE_OLDCAS", default_conf.AUTHENS_USE_OLDCAS): - urlpatterns += ( + urlpatterns += [ path("login/oldcas", views.OldCASLoginView.as_view(), name="login.oldcas"), - ) + ] diff --git a/authens/views.py b/authens/views.py index bcdc702..a1e47da 100644 --- a/authens/views.py +++ b/authens/views.py @@ -55,6 +55,9 @@ class LoginSwitchView(NextPageMixin, TemplateView): "oldcas": getattr( settings, "AUTHENS_USE_OLDCAS", default_conf.AUTHENS_USE_OLDCAS ), + "password": getattr( + settings, "AUTHENS_USE_PASSWORD", default_conf.AUTHENS_USE_PASSWORD + ), } ) return ctx