Sha256: dc27375555a92ae83ef05295222c70bad499a5359d6c51c188b76fa1191f2b66
Contents?: true
Size: 1 KB
Versions: 7
Compression:
Stored size: 1 KB
Contents
# frozen_string_literal: true require 'g5_authentication_client' module Devise module G5 # Update user data on G5 Auth server class AuthUserUpdater attr_reader :model def initialize(authenticatable_model) @model = authenticatable_model end def update update_auth_user if credentials_changed? end private def update_auth_user auth_user = auth_client.update_user(auth_user_args) model.clean_up_passwords auth_user end def credentials_changed? model.email_changed? || !model.password.blank? end def auth_client G5AuthenticationClient::Client.new( access_token: updated_by.g5_access_token ) end def updated_by model.updated_by || model end def auth_user_args { id: model.uid, email: model.email, password: model.password, password_confirmation: model.password_confirmation } end end end end
Version data entries
7 entries across 7 versions & 1 rubygems