Merge branch 'thubrecht/disable-password' into 'master'

Permet de désactiver la connexion par mot de passe

See merge request klub-dev-ens/authens!30
This commit is contained in:
Martin Pepin 2021-04-06 17:57:58 +00:00
commit 0898640785
4 changed files with 19 additions and 9 deletions

View file

@ -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

View file

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

View file

@ -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/<uidb64>/<token>/",
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/<uidb64>/<token>/",
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"),
)
]

View file

@ -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