Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #420 avoid scratch passwd #429

Merged
merged 1 commit into from
Nov 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions backend/gncitizen/core/users/models.py
Original file line number Diff line number Diff line change
@@ -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


Expand Down Expand Up @@ -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"<hash_user_password> OLD PWD {oldvalue} / NEW PWD {value != ''}")
print(f"PASSWORD VALUE {value} / OLDVALUE {oldvalue}")
if value != "" and not sha256.identify(value):
logger.debug("<hash_user_password> Update new password")
return UserModel.generate_hash(value)
return value
return oldvalue


class GroupsModel(db.Model):
Expand Down
1 change: 1 addition & 0 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down