diff --git a/authens/static/authens/css/authens.css b/authens/static/authens/css/authens.css new file mode 100644 index 0000000..66379b1 --- /dev/null +++ b/authens/static/authens/css/authens.css @@ -0,0 +1,106 @@ +html, body { + width: 100%; + background: #eee; + font-family: sans-serif; + margin: 0; + padding: 0; +} + +#container { + display: flex; + flex-flow: row wrap; + padding: 10% 1em; + min-width: 300px; + max-width: 900px; + margin: auto; +} + +h2 { + margin: 0; + padding: 15px; + width: 100%; + background: #505160; + color: white; + font-weight: initial; + font-size: 2em; +} + +.cas { + background: #4D85BD; + color: white; +} + +.exte { + background: #749F2A; + color: white; +} + +/* TODO: https://git.eleves.ens.fr/klub-dev-ens/authens/issues/9 */ +.oldcas { + background: #CB6318; + color: white; +} + +form { + padding: 0.5em; + text-align: center; + width: 100%; + font-size: 1.5em; +} + +.error { + background: red; + color: white; + width: 100%; + padding: 0.5em; + margin: 0; + font-size: 1.2em; + text-align: center; +} + +form table { + margin: auto; + border-spacing: 0.3em; +} + +th { + text-align: right; +} + +input { + font-size: 1em; +} + +input[type="text"], input[type="password"] { + border: 0; + padding: 5px; +} + +input[type="submit"] { + font-size: 1.2em; + background: #505160; + color: white; + border-radius: 0.25rem; + border: solid #505160; + padding: 0.2em 0.5em; + cursor: pointer; +} + +input[type="submit"]:hover { + border-color: white; +} + +a { + flex: 1; + height: 200px; + min-width: 300px; + text-align: center; + font-size: 2.5em; + color: white; + line-height: 200px; + text-decoration: none; +} + +a:hover { + text-decoration: underline; +} diff --git a/authens/templates/authens/base.html b/authens/templates/authens/base.html new file mode 100644 index 0000000..f8714d5 --- /dev/null +++ b/authens/templates/authens/base.html @@ -0,0 +1,21 @@ +{% load static %} + + + + + + + + + + + + {% if request.site.name %}{{ request.site.name }}{% else %}AuthENS{% endif %} - login + + + +
+ {% block content %}{% endblock %} +
+ + diff --git a/authens/templates/authens/login_switch.html b/authens/templates/authens/login_switch.html index fe16203..16917d1 100644 --- a/authens/templates/authens/login_switch.html +++ b/authens/templates/authens/login_switch.html @@ -1,17 +1,23 @@ +{% extends "authens/base.html" %} {% load i18n %} - - - - - ENS Auth - - -

- {% trans "Login par CAS" %} -

-

- {% trans "Login par mot de passe" %} -

- - +{% block content %} +

{% if request.site.name %}{{ request.site.name }}{% else %}AuthENS{% endif %} - {% trans "Mode de connexion" %}

+ +
+ {% trans "Clipper" %} +
+
+ +
+ {% trans "Mot de passe" %} +
+
+ {% comment %} TODO: https://git.eleves.ens.fr/klub-dev-ens/authens/issues/9 + +
+ {% trans "Vieilleux" %} +
+
+ {% endcomment %} +{% endblock %} diff --git a/authens/templates/authens/pwd_login.html b/authens/templates/authens/pwd_login.html index 960d5b8..94b0321 100644 --- a/authens/templates/authens/pwd_login.html +++ b/authens/templates/authens/pwd_login.html @@ -1,38 +1,26 @@ - - - - - ENS Auth - - - {% if form.errors %} -

Your username and password didn't match. Please try again.

- {% endif %} +{% extends "authens/base.html" %} +{% load i18n %} - {% if next %} - {% if user.is_authenticated %} -

Your account doesn't have access to this page. To proceed, - please login with an account that has access.

- {% else %} -

Please login to see this page.

- {% endif %} - {% endif %} +{% block content %} +

{% if request.site.name %}{{ request.site.name }}{% else %}AuthENS{% endif %} - {% trans "Connexion par mot de passe" %}

-
- {% csrf_token %} - - - - - - - - - -
{{ form.username.label_tag }}{{ form.username }}
{{ form.password.label_tag }}{{ form.password }}
+ {% if form.errors %} +

{% trans "Nom d'utilisateur et/ou mot de passe incorrect" %}

+ {% endif %} - - -
- - +
+ {% csrf_token %} + + + {% for field in form %} + + + + + {% endfor %} + +
{{ field.label_tag }}{{ field }}
+ + +
+{% endblock %} diff --git a/example_site/example_site/settings.py b/example_site/example_site/settings.py index d2e7c11..3148128 100644 --- a/example_site/example_site/settings.py +++ b/example_site/example_site/settings.py @@ -120,13 +120,15 @@ STATIC_URL = "/static/" from django.urls import reverse_lazy # noqa +# This is mandatory INSTALLED_APPS += ["example", "authens"] - AUTHENTICATION_BACKENDS = [ "django.contrib.auth.backends.ModelBackend", "authens.backends.ENSCASBackend", ] - LOGIN_URL = reverse_lazy("authens:login") + +# This is cosmetic LOGIN_REDIRECT_URL = reverse_lazy("home") LOGOUT_REDIRECT_URL = reverse_lazy("home") +LANGUAGE_CODE = "fr-fr"