Ajout du style pour la page de connexion
This commit is contained in:
parent
e97b1d1659
commit
38f24a3ec3
@ -62,3 +62,18 @@ class Session:
|
||||
"JOIN sessions ON utilisateurs.user_id=sessions.user_id WHERE session_id=%s", (self.uuid,))
|
||||
result = cursor.fetchall()
|
||||
return User(*result[0])
|
||||
|
||||
def fetch_grades(self):
|
||||
cursor = self.db.db.cursor()
|
||||
cursor.execute("SELECT matieres.libelle, devoirs.libelle, date, coefficient, valeur, maximum FROM notes "
|
||||
"JOIN devoirs ON notes.id_devoir=devoirs.id_devoir "
|
||||
"JOIN matieres ON devoirs.id_matiere=matieres.id_matiere WHERE id_eleve=%s", (self.user.id,))
|
||||
|
||||
result = cursor.fetchall()
|
||||
dico = {}
|
||||
for note in result:
|
||||
if note[0] in dico:
|
||||
dico[note[0]].append(note)
|
||||
else:
|
||||
dico[note[0]] = [note]
|
||||
return dico
|
44
app/static/login.css
Normal file
44
app/static/login.css
Normal file
@ -0,0 +1,44 @@
|
||||
body {
|
||||
width: clamp(400px, 65%, 800px);
|
||||
margin: 50px auto;
|
||||
font-family: "Montserrat", sans-serif;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
form table {
|
||||
margin: 30px auto;
|
||||
}
|
||||
|
||||
form input[type=text], form input[type=password] {
|
||||
padding: 10px;
|
||||
border: none;
|
||||
background-color: #eee;
|
||||
transition: 200ms background-color;
|
||||
}
|
||||
|
||||
form input[type=text]:hover, form input[type=password]:hover {
|
||||
background-color: #ddd;
|
||||
}
|
||||
|
||||
input[type=submit] {
|
||||
border: none;
|
||||
background-color: dodgerblue;
|
||||
color: white;
|
||||
padding: 5px 10px;
|
||||
border-radius: 3px;
|
||||
transition: 200ms background-color, 200ms color;
|
||||
}
|
||||
|
||||
input[type=submit]:hover {
|
||||
background-color: #ddd;
|
||||
color: black;
|
||||
}
|
||||
|
||||
input[type=submit]:active {
|
||||
background-color: #bbb;
|
||||
}
|
||||
|
||||
p.error-box {
|
||||
padding: 10px;
|
||||
background-color: #ef9a9a;
|
||||
}
|
@ -90,7 +90,13 @@ body {
|
||||
background-color: var(--theme-color-light);
|
||||
}
|
||||
|
||||
main {
|
||||
margin: 10px;
|
||||
}
|
||||
|
||||
.grade-report td, .grade-report th {
|
||||
padding: 5px;
|
||||
}
|
||||
|
||||
footer {
|
||||
background-color: #46484d;
|
||||
|
@ -8,15 +8,17 @@
|
||||
|
||||
<h1>Mes notes</h1>
|
||||
|
||||
<ul id="liste-notes">
|
||||
<li>
|
||||
<span class="section">Mathématiques</span>
|
||||
<ul>
|
||||
<li>12/20</li>
|
||||
<li>15/20</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>Philosophie</li>
|
||||
</ul>
|
||||
<table class="grade-report">
|
||||
{% for matiere, notes in grades.items() %}
|
||||
<tr><th colspan=3>{{ matiere }}</th></tr>
|
||||
{% for note in notes %}
|
||||
<tr>
|
||||
<td>{{ note[1] }}</td>
|
||||
<td>{{ note[4] }}/{{ note[5] }}</td>
|
||||
<td>coeff. {{ note[3] }}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
{% endfor %}
|
||||
</table>
|
||||
|
||||
{% endblock %}
|
@ -6,9 +6,6 @@
|
||||
|
||||
<h1>Bienvenue sur Antinote !</h1>
|
||||
|
||||
Ce site est encore en construction. yo
|
||||
|
||||
{{ session }}
|
||||
|
||||
Vous pouvez vous déplacer dans le site à l'aide des menus.
|
||||
|
||||
{% endblock %}
|
@ -5,12 +5,20 @@
|
||||
<meta name="viewport"
|
||||
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
|
||||
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
||||
<link href="/static/login.css" rel="stylesheet" type="text/css">
|
||||
<title>Se connecter</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Se connecter</h1>
|
||||
<p>Vous pouvez utiliser les identifiants de démonstration : <strong>demo</strong>/<strong>demo</strong>.</p>
|
||||
{% if request.args["error"] %}
|
||||
<p class="error-box">Nom d'utilisateur ou mot de passe invalide.</p>
|
||||
{% endif %}
|
||||
<form method="post">
|
||||
<input type="text" name="username">
|
||||
<input type="password" name="password">
|
||||
<table>
|
||||
<tr><th>Nom d'utilisateur</th><td><input type="text" name="username"></td></tr>
|
||||
<tr><th>Mot de passe</th><td><input type="password" name="password"></td></tr>
|
||||
</table>
|
||||
<input type="submit">
|
||||
</form>
|
||||
</body>
|
||||
|
@ -6,6 +6,6 @@
|
||||
|
||||
<h1>Emploi du temps</h1>
|
||||
|
||||
Ce site est encore en construction.
|
||||
Veuillez attendre encore un peu pour que cette fonctionnalité soit implémentée.
|
||||
|
||||
{% endblock %}
|
@ -30,19 +30,22 @@ def views(app, db):
|
||||
request.form["username"],
|
||||
sha256(request.form["password"].encode()).hexdigest()
|
||||
)
|
||||
return redirect("/")
|
||||
|
||||
return redirect("/") if session["uuid"] else redirect("/login?error=1")
|
||||
|
||||
@app.route("/logout/")
|
||||
@login_required
|
||||
def logout():
|
||||
db.destroy_session(session["uuid"])
|
||||
session["uuid"] = None
|
||||
return redirect("/login/")
|
||||
return redirect("/login")
|
||||
|
||||
@app.route("/grades/")
|
||||
@login_required
|
||||
def grades():
|
||||
return render_template("grades.html", s=Session(db, session["uuid"]))
|
||||
s = Session(db, session["uuid"])
|
||||
grades = s.fetch_grades()
|
||||
return render_template("grades.html", s=s, grades=grades)
|
||||
|
||||
@app.route("/timetable/")
|
||||
@login_required
|
||||
|
Loading…
Reference in New Issue
Block a user