pw: unconditionnaly update passwords
To prevent newer password from authentic to be ovewritten, we should implement the same signals in authentic so that the synchronization on passwords is bidirectionnal.
This commit is contained in:
parent
07ba049c62
commit
79bce957d2
|
@ -24,11 +24,8 @@ def user_pre_save(sender, instance, raw, using, *args,
|
|||
return
|
||||
if not 'authentic' in settings.DATABASES:
|
||||
return
|
||||
update_password = False
|
||||
if instance.id:
|
||||
old_instance = User.objects.using(using).get(id=instance.id)
|
||||
if old_instance.password != instance.password:
|
||||
update_password = True
|
||||
username = old_instance.username
|
||||
else:
|
||||
username = instance.username
|
||||
|
@ -41,6 +38,5 @@ def user_pre_save(sender, instance, raw, using, *args,
|
|||
user.first_name = instance.first_name
|
||||
user.last_name = instance.last_name
|
||||
user.email = instance.email
|
||||
if update_password:
|
||||
user.password = instance.password
|
||||
user.password = instance.password
|
||||
user.save(using='authentic')
|
||||
|
|
Loading…
Reference in New Issue