From 46c64ba78b542e0013dc2227d743a6c3ca52b351 Mon Sep 17 00:00:00 2001 From: Emmanuel Viennet Date: Mon, 3 Jan 2022 12:33:27 +0100 Subject: [PATCH 1/3] comments --- app/auth/models.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/app/auth/models.py b/app/auth/models.py index bc4edb65..8f187b7e 100644 --- a/app/auth/models.py +++ b/app/auth/models.py @@ -11,7 +11,7 @@ from time import time from typing import Optional import cracklib # pylint: disable=import-error -from flask import current_app, url_for, g +from flask import current_app, g from flask_login import UserMixin, AnonymousUserMixin from werkzeug.security import generate_password_hash, check_password_hash @@ -136,6 +136,7 @@ class User(UserMixin, db.Model): return check_password_hash(self.password_hash, password) def get_reset_password_token(self, expires_in=600): + "Un token pour réinitialiser son mot de passe" return jwt.encode( {"reset_password": self.id, "exp": time() + expires_in}, current_app.config["SECRET_KEY"], @@ -144,15 +145,17 @@ class User(UserMixin, db.Model): @staticmethod def verify_reset_password_token(token): + "Vérification du token de reéinitialisation du mot de passe" try: - id = jwt.decode( + user_id = jwt.decode( token, current_app.config["SECRET_KEY"], algorithms=["HS256"] )["reset_password"] except: return - return User.query.get(id) + return User.query.get(user_id) def to_dict(self, include_email=True): + """l'utilisateur comme un dict, avec des champs supplémentaires""" data = { "date_expiration": self.date_expiration.isoformat() + "Z" if self.date_expiration @@ -472,5 +475,5 @@ def get_super_admin(): @login.user_loader -def load_user(id): - return User.query.get(int(id)) +def load_user(uid): + return User.query.get(int(uid)) -- 2.45.1 From 35ae8a032893934f9c70a41d52e0e4dc3e6f1c88 Mon Sep 17 00:00:00 2001 From: Emmanuel Viennet Date: Tue, 4 Jan 2022 11:29:54 +0100 Subject: [PATCH 2/3] test --- sco_version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sco_version.py b/sco_version.py index bc906576..97c73d95 100644 --- a/sco_version.py +++ b/sco_version.py @@ -1,7 +1,7 @@ # -*- mode: python -*- # -*- coding: utf-8 -*- -SCOVERSION = "9.1.16" +SCOVERSION = "9.1.16idk" SCONAME = "ScoDoc" -- 2.45.1 From fdefaa6e1f3969833866d254c86a9dfa814ac033 Mon Sep 17 00:00:00 2001 From: Emmanuel Viennet Date: Tue, 4 Jan 2022 11:35:15 +0100 Subject: [PATCH 3/3] essai 2 --- sco_version.py | 2 +- toto | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) create mode 100644 toto diff --git a/sco_version.py b/sco_version.py index 97c73d95..bc906576 100644 --- a/sco_version.py +++ b/sco_version.py @@ -1,7 +1,7 @@ # -*- mode: python -*- # -*- coding: utf-8 -*- -SCOVERSION = "9.1.16idk" +SCOVERSION = "9.1.16" SCONAME = "ScoDoc" diff --git a/toto b/toto new file mode 100644 index 00000000..d882d487 --- /dev/null +++ b/toto @@ -0,0 +1 @@ +hello essai -- 2.45.1