forked from DGNum/gestioCOF
move account save
This commit is contained in:
parent
5654fd84e8
commit
46e9e82da8
2 changed files with 4 additions and 3 deletions
|
@ -206,7 +206,6 @@ class Account(models.Model):
|
||||||
pwd_sha256 = hashlib.sha256(pwd.encode('utf-8'))\
|
pwd_sha256 = hashlib.sha256(pwd.encode('utf-8'))\
|
||||||
.hexdigest()
|
.hexdigest()
|
||||||
self.password = pwd_sha256
|
self.password = pwd_sha256
|
||||||
self.save()
|
|
||||||
|
|
||||||
# Surcharge de delete
|
# Surcharge de delete
|
||||||
# Pas de suppression possible
|
# Pas de suppression possible
|
||||||
|
|
|
@ -396,12 +396,12 @@ def account_update(request, trigramme):
|
||||||
account_form = AccountForm(request.POST, instance=account)
|
account_form = AccountForm(request.POST, instance=account)
|
||||||
cof_form = CofRestrictForm(request.POST,
|
cof_form = CofRestrictForm(request.POST,
|
||||||
instance=account.cofprofile)
|
instance=account.cofprofile)
|
||||||
user_form = UserRestrictTeamForm(request.POST,
|
user_form = UserRestrictTeamForm(request.POST,
|
||||||
instance=account.user)
|
instance=account.user)
|
||||||
group_form = UserGroupForm(request.POST, instance=account.user)
|
group_form = UserGroupForm(request.POST, instance=account.user)
|
||||||
pwd_form = AccountPwdForm(request.POST)
|
pwd_form = AccountPwdForm(request.POST)
|
||||||
if hasattr(account, 'negative'):
|
if hasattr(account, 'negative'):
|
||||||
negative_form = AccountNegativeForm(request.POST,
|
negative_form = AccountNegativeForm(request.POST,
|
||||||
instance=account.negative)
|
instance=account.negative)
|
||||||
|
|
||||||
if (request.user.has_perm('kfet.change_account')
|
if (request.user.has_perm('kfet.change_account')
|
||||||
|
@ -421,6 +421,7 @@ def account_update(request, trigramme):
|
||||||
and pwd_form.is_valid()):
|
and pwd_form.is_valid()):
|
||||||
pwd = pwd_form.cleaned_data['pwd1']
|
pwd = pwd_form.cleaned_data['pwd1']
|
||||||
account.change_pwd(pwd)
|
account.change_pwd(pwd)
|
||||||
|
account.save()
|
||||||
messages.success(request, 'Mot de passe mis à jour')
|
messages.success(request, 'Mot de passe mis à jour')
|
||||||
|
|
||||||
# Checking perm to manage perms
|
# Checking perm to manage perms
|
||||||
|
@ -474,6 +475,7 @@ def account_update(request, trigramme):
|
||||||
and pwd_form.is_valid():
|
and pwd_form.is_valid():
|
||||||
pwd = pwd_form.cleaned_data['pwd1']
|
pwd = pwd_form.cleaned_data['pwd1']
|
||||||
account.change_pwd(pwd)
|
account.change_pwd(pwd)
|
||||||
|
account.save()
|
||||||
messages.success(
|
messages.success(
|
||||||
request, 'Votre mot de passe a été mis à jour')
|
request, 'Votre mot de passe a été mis à jour')
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue