From 6f075d97ba467a7891066aa3b51bdb93d20c2f54 Mon Sep 17 00:00:00 2001 From: hypsug0 Date: Thu, 21 Nov 2024 00:27:09 +0100 Subject: [PATCH] fix #420, avoid scratching password from backoffice --- backend/gncitizen/core/users/models.py | 8 ++++---- docs/CHANGELOG.md | 1 + 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/backend/gncitizen/core/users/models.py b/backend/gncitizen/core/users/models.py index f199f0b9..7b4d8eb5 100644 --- a/backend/gncitizen/core/users/models.py +++ b/backend/gncitizen/core/users/models.py @@ -1,14 +1,13 @@ #!/usr/bin/env python3 from flask import current_app +from gncitizen.core.commons.models import ProgramsModel, TimestampMixinModel, TModules from passlib.hash import pbkdf2_sha256 as sha256 +from server import db from sqlalchemy import event from sqlalchemy.ext.declarative import declared_attr from utils_flask_sqla_geo.serializers import serializable -from gncitizen.core.commons.models import ProgramsModel, TimestampMixinModel, TModules -from server import db - logger = current_app.logger @@ -130,10 +129,11 @@ def __repr__(self): def hash_user_password(_target, value, oldvalue, _initiator): """Evenement qui hash le mot de passe systèmatiquement""" logger.debug(f" OLD PWD {oldvalue} / NEW PWD {value != ''}") + print(f"PASSWORD VALUE {value} / OLDVALUE {oldvalue}") if value != "" and not sha256.identify(value): logger.debug(" Update new password") return UserModel.generate_hash(value) - return value + return oldvalue class GroupsModel(db.Model): diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 809d3551..2c9c1e26 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -9,6 +9,7 @@ ### Fixes * Standardization of frontend map components between site and observation modules (#415 by @xavyeah39) +* Fix password scratch when user profile edited from backoffice, cf. #420 (#429 by @hypsug0) ## 1.1.0 - 2024-04-06