forked from DGNum/gestioCOF
Fix encodage password
This commit is contained in:
parent
58cb6015fc
commit
5569b7d154
2 changed files with 2 additions and 2 deletions
|
@ -18,7 +18,7 @@ class KFetBackend(object):
|
||||||
return None
|
return None
|
||||||
|
|
||||||
try:
|
try:
|
||||||
password_sha256 = hashlib.sha256(password.encode()).hexdigest()
|
password_sha256 = hashlib.sha256(password.encode('utf-8')).hexdigest()
|
||||||
account = Account.objects.get(password=password_sha256)
|
account = Account.objects.get(password=password_sha256)
|
||||||
user = account.cofprofile.user
|
user = account.cofprofile.user
|
||||||
except Account.DoesNotExist:
|
except Account.DoesNotExist:
|
||||||
|
|
|
@ -399,7 +399,7 @@ def account_update(request, trigramme):
|
||||||
if (request.user.has_perm('kfet.change_account_password')
|
if (request.user.has_perm('kfet.change_account_password')
|
||||||
and pwd_form.is_valid()):
|
and pwd_form.is_valid()):
|
||||||
pwd = pwd_form.cleaned_data['pwd1']
|
pwd = pwd_form.cleaned_data['pwd1']
|
||||||
pwd_sha256 = hashlib.sha256(pwd.encode()).hexdigest()
|
pwd_sha256 = hashlib.sha256(pwd.encode('utf-8')).hexdigest()
|
||||||
Account.objects.filter(pk=account.pk).update(
|
Account.objects.filter(pk=account.pk).update(
|
||||||
password = pwd_sha256)
|
password = pwd_sha256)
|
||||||
messages.success(request, 'Mot de passe mis à jour')
|
messages.success(request, 'Mot de passe mis à jour')
|
||||||
|
|
Loading…
Reference in a new issue