mirror of
https://github.com/partitioncloud/partitioncloud-server.git
synced 2025-04-22 05:33:55 +02:00
Add h2 to login/ register
This commit is contained in:
parent
1cb8d45960
commit
782da97a1f
@ -94,15 +94,17 @@ def register():
|
||||
(username, generate_password_hash(password)),
|
||||
)
|
||||
db.commit()
|
||||
flash(f"Utilisateur {username} créé avec succès. Vous pouvez vous connecter.")
|
||||
except db.IntegrityError:
|
||||
# The username was already taken, which caused the
|
||||
# commit to fail. Show a validation error.
|
||||
error = f"Le nom d'utilisateur {username} est déjà pris."
|
||||
error = f"Le nom d'utilisateur {username} est déjà pris. Vous souhaitez peut-être vous connecter"
|
||||
else:
|
||||
# Success, go to the login page.
|
||||
return redirect(url_for("auth.login"))
|
||||
|
||||
flash(error)
|
||||
db.close()
|
||||
|
||||
return render_template("auth/register.html")
|
||||
|
||||
@ -119,10 +121,8 @@ def login():
|
||||
"SELECT * FROM user WHERE username = ?", (username,)
|
||||
).fetchone()
|
||||
|
||||
if user is None:
|
||||
error = "Incorrect username."
|
||||
elif not check_password_hash(user["password"], password):
|
||||
error = "Incorrect password."
|
||||
if (user is None) or not check_password_hash(user["password"], password):
|
||||
error = "Nom d'utilisateur ou mot de passe incorrect."
|
||||
|
||||
if error is None:
|
||||
# store the user id in a new session and return to the index
|
||||
|
@ -1,8 +1,9 @@
|
||||
{% extends 'base.html' %}
|
||||
|
||||
{% block title %}Connexion{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<h2>{% block title %}Connexion{% endblock %}</h2>
|
||||
|
||||
<form method="post">
|
||||
<input type="text" name="username" id="username" placeholder="Nom d'utilisateur" required><br/>
|
||||
<input type="password" name="password" id="password" placeholder="Mot de passe" required><br/>
|
||||
|
@ -1,8 +1,9 @@
|
||||
{% extends 'base.html' %}
|
||||
|
||||
{% block title %}Créer un compte{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<h2>{% block title %}Créer un compte{% endblock %}</h2>
|
||||
|
||||
<form method="post" id="add-user-form">
|
||||
{% if g.user.access_level == 1 %}
|
||||
<!-- Uniquement pour /add-user -->
|
||||
|
@ -7,7 +7,7 @@
|
||||
{% block content %}
|
||||
Êtes vous sûr de vouloir supprimer cette partition ?
|
||||
<form method="post">
|
||||
<input type="submit" value="Supprimer">
|
||||
<input type="submit" id="delete-partition" value="Supprimer">
|
||||
</form>
|
||||
<a class="button-href" href="/albums/{{ partition.uuid }}/edit">
|
||||
<button id="cancel-deletion">Annuler</button>
|
||||
|
Loading…
x
Reference in New Issue
Block a user