Ajout du style pour la page de connexion
This commit is contained in:
parent
e97b1d1659
commit
38f24a3ec3
@ -61,4 +61,19 @@ class Session:
|
|||||||
cursor.execute("SELECT utilisateurs.user_id, username, nom, prenom, creation_date FROM utilisateurs "
|
cursor.execute("SELECT utilisateurs.user_id, username, nom, prenom, creation_date FROM utilisateurs "
|
||||||
"JOIN sessions ON utilisateurs.user_id=sessions.user_id WHERE session_id=%s", (self.uuid,))
|
"JOIN sessions ON utilisateurs.user_id=sessions.user_id WHERE session_id=%s", (self.uuid,))
|
||||||
result = cursor.fetchall()
|
result = cursor.fetchall()
|
||||||
return User(*result[0])
|
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);
|
background-color: var(--theme-color-light);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
main {
|
||||||
|
margin: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.grade-report td, .grade-report th {
|
||||||
|
padding: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
footer {
|
footer {
|
||||||
background-color: #46484d;
|
background-color: #46484d;
|
||||||
|
@ -8,15 +8,17 @@
|
|||||||
|
|
||||||
<h1>Mes notes</h1>
|
<h1>Mes notes</h1>
|
||||||
|
|
||||||
<ul id="liste-notes">
|
<table class="grade-report">
|
||||||
<li>
|
{% for matiere, notes in grades.items() %}
|
||||||
<span class="section">Mathématiques</span>
|
<tr><th colspan=3>{{ matiere }}</th></tr>
|
||||||
<ul>
|
{% for note in notes %}
|
||||||
<li>12/20</li>
|
<tr>
|
||||||
<li>15/20</li>
|
<td>{{ note[1] }}</td>
|
||||||
</ul>
|
<td>{{ note[4] }}/{{ note[5] }}</td>
|
||||||
</li>
|
<td>coeff. {{ note[3] }}</td>
|
||||||
<li>Philosophie</li>
|
</tr>
|
||||||
</ul>
|
{% endfor %}
|
||||||
|
{% endfor %}
|
||||||
|
</table>
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
@ -6,9 +6,6 @@
|
|||||||
|
|
||||||
<h1>Bienvenue sur Antinote !</h1>
|
<h1>Bienvenue sur Antinote !</h1>
|
||||||
|
|
||||||
Ce site est encore en construction. yo
|
Vous pouvez vous déplacer dans le site à l'aide des menus.
|
||||||
|
|
||||||
{{ session }}
|
|
||||||
|
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
@ -5,12 +5,20 @@
|
|||||||
<meta name="viewport"
|
<meta name="viewport"
|
||||||
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
|
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">
|
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
||||||
|
<link href="/static/login.css" rel="stylesheet" type="text/css">
|
||||||
<title>Se connecter</title>
|
<title>Se connecter</title>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<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">
|
<form method="post">
|
||||||
<input type="text" name="username">
|
<table>
|
||||||
<input type="password" name="password">
|
<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">
|
<input type="submit">
|
||||||
</form>
|
</form>
|
||||||
</body>
|
</body>
|
||||||
|
@ -6,6 +6,6 @@
|
|||||||
|
|
||||||
<h1>Emploi du temps</h1>
|
<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 %}
|
{% endblock %}
|
@ -30,19 +30,22 @@ def views(app, db):
|
|||||||
request.form["username"],
|
request.form["username"],
|
||||||
sha256(request.form["password"].encode()).hexdigest()
|
sha256(request.form["password"].encode()).hexdigest()
|
||||||
)
|
)
|
||||||
return redirect("/")
|
|
||||||
|
return redirect("/") if session["uuid"] else redirect("/login?error=1")
|
||||||
|
|
||||||
@app.route("/logout/")
|
@app.route("/logout/")
|
||||||
@login_required
|
@login_required
|
||||||
def logout():
|
def logout():
|
||||||
db.destroy_session(session["uuid"])
|
db.destroy_session(session["uuid"])
|
||||||
session["uuid"] = None
|
session["uuid"] = None
|
||||||
return redirect("/login/")
|
return redirect("/login")
|
||||||
|
|
||||||
@app.route("/grades/")
|
@app.route("/grades/")
|
||||||
@login_required
|
@login_required
|
||||||
def grades():
|
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/")
|
@app.route("/timetable/")
|
||||||
@login_required
|
@login_required
|
||||||
|
Loading…
Reference in New Issue
Block a user