Skip to content

Commit

Permalink
Merge pull request #429 from hypsug0/fix_420_avoid_scratch_passwd
Browse files Browse the repository at this point in the history
Fix #420 avoid scratch passwd
  • Loading branch information
hypsug0 authored Nov 20, 2024
2 parents 69c242d + 6f075d9 commit eac44ea
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
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

0 comments on commit eac44ea

Please sign in to comment.