Merge branch 'kerl/templates' into 'master'
Première tentative de templates See merge request klub-dev-ens/authens!9
This commit is contained in:
commit
6e51e555f6
5 changed files with 175 additions and 52 deletions
106
authens/static/authens/css/authens.css
Normal file
106
authens/static/authens/css/authens.css
Normal file
|
@ -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;
|
||||
}
|
21
authens/templates/authens/base.html
Normal file
21
authens/templates/authens/base.html
Normal file
|
@ -0,0 +1,21 @@
|
|||
{% load static %}
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="content-type" content="text/html; charset=utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta http-equiv="viewport" content="width=device-width, initial-scale=1">
|
||||
|
||||
<link rel="stylesheet" href="{% static "authens/css/authens.css" %}" type="text/css">
|
||||
|
||||
<title>
|
||||
{% if request.site.name %}{{ request.site.name }}{% else %}AuthENS{% endif %} - login
|
||||
</title>
|
||||
</head>
|
||||
<body>
|
||||
<div id="container">
|
||||
{% block content %}{% endblock %}
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
|
@ -1,17 +1,23 @@
|
|||
{% extends "authens/base.html" %}
|
||||
{% load i18n %}
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="content-type" content="text/html; charset=utf-8">
|
||||
<title>ENS Auth</title>
|
||||
</head>
|
||||
<body>
|
||||
<p><a href="{% url "authens:login.cas" %}?next={{ next| urlencode }}">
|
||||
{% trans "Login par CAS" %}
|
||||
</a></p>
|
||||
<p><a href="{% url "authens:login.pwd" %}?next={{ next| urlencode }}">
|
||||
{% trans "Login par mot de passe" %}
|
||||
</a></p>
|
||||
</body>
|
||||
</html>
|
||||
{% block content %}
|
||||
<h2>{% if request.site.name %}{{ request.site.name }}{% else %}AuthENS{% endif %} - {% trans "Mode de connexion" %}</h2>
|
||||
<a href="{% url "authens:login.cas" %}?next={{ next| urlencode }}">
|
||||
<div class="big-button cas">
|
||||
{% trans "Clipper" %}
|
||||
</div>
|
||||
</a>
|
||||
<a href="{% url "authens:login.pwd" %}?next={{ next| urlencode }}">
|
||||
<div class="big-button exte">
|
||||
{% trans "Mot de passe" %}
|
||||
</div>
|
||||
</a>
|
||||
{% comment %} TODO: https://git.eleves.ens.fr/klub-dev-ens/authens/issues/9
|
||||
<a href="#TODO">
|
||||
<div class="big-button oldcas">
|
||||
{% trans "Vieilleux" %}
|
||||
</div>
|
||||
</a>
|
||||
{% endcomment %}
|
||||
{% endblock %}
|
||||
|
|
|
@ -1,38 +1,26 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="content-type" content="text/html; charset=utf-8">
|
||||
<title>ENS Auth</title>
|
||||
</head>
|
||||
<body>
|
||||
{% extends "authens/base.html" %}
|
||||
{% load i18n %}
|
||||
|
||||
{% block content %}
|
||||
<h2>{% if request.site.name %}{{ request.site.name }}{% else %}AuthENS{% endif %} - {% trans "Connexion par mot de passe" %}</h2>
|
||||
|
||||
{% if form.errors %}
|
||||
<p>Your username and password didn't match. Please try again.</p>
|
||||
<p class="error">{% trans "Nom d'utilisateur et/ou mot de passe incorrect" %}</p>
|
||||
{% endif %}
|
||||
|
||||
{% if next %}
|
||||
{% if user.is_authenticated %}
|
||||
<p>Your account doesn't have access to this page. To proceed,
|
||||
please login with an account that has access.</p>
|
||||
{% else %}
|
||||
<p>Please login to see this page.</p>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
<form method="post" action="{% url 'authens:login.pwd' %}">
|
||||
<form class="exte" method="post" action="{% url 'authens:login.pwd' %}">
|
||||
{% csrf_token %}
|
||||
<table>
|
||||
<tbody>
|
||||
{% for field in form %}
|
||||
<tr>
|
||||
<td>{{ form.username.label_tag }}</td>
|
||||
<td>{{ form.username }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>{{ form.password.label_tag }}</td>
|
||||
<td>{{ form.password }}</td>
|
||||
<th>{{ field.label_tag }}</th>
|
||||
<td>{{ field }}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<input type="submit" value="login">
|
||||
<input type="submit" value="{% trans "Se connecter" %}">
|
||||
<input type="hidden" name="next" value="{{ next }}">
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
||||
{% endblock %}
|
||||
|
|
|
@ -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"
|
||||
|
|
Loading…
Reference in a new issue