Sync credentials between user, gestionnaire and administrateur account

This commit is contained in:
Xavier J 2016-12-07 17:24:01 +01:00
parent d282d7bbea
commit 7cb2e80a3d
7 changed files with 96 additions and 12 deletions

View file

@ -88,12 +88,7 @@ class Gestionnaire < ActiveRecord::Base
def sync_credentials
if email_changed? || encrypted_password_changed?
user = User.find_by(email: email_was)
if user
return user.update_columns(
email: email,
encrypted_password: encrypted_password)
end
return SyncCredentialsService.new(Gestionnaire, email_was, email, encrypted_password).change_credentials!
end
true
end