Update LDAP mail attribute when re-confirming email
This commit is contained in:
parent
61f12c2741
commit
7b321577db
@ -58,13 +58,19 @@ class User < ApplicationRecord
|
||||
end
|
||||
|
||||
def devise_after_confirmation
|
||||
enable_service %w[ discourse gitea mediawiki xmpp ]
|
||||
if ldap_entry[:mail] != self.email
|
||||
# E-Mail update confirmed
|
||||
LdapManager::UpdateEmail.call(self.dn, self.email)
|
||||
else
|
||||
# E-Mail from signup confirmed (i.e. account activation)
|
||||
enable_service %w[ discourse gitea mediawiki xmpp ]
|
||||
|
||||
#TODO enable in development when we have easy setup of ejabberd etc.
|
||||
return if Rails.env.development? || !Setting.ejabberd_enabled?
|
||||
#TODO enable in development when we have easy setup of ejabberd etc.
|
||||
return if Rails.env.development? || !Setting.ejabberd_enabled?
|
||||
|
||||
XmppExchangeContactsJob.perform_later(inviter, self) if inviter.present?
|
||||
XmppSetDefaultBookmarksJob.perform_later(self)
|
||||
XmppExchangeContactsJob.perform_later(inviter, self) if inviter.present?
|
||||
XmppSetDefaultBookmarksJob.perform_later(self)
|
||||
end
|
||||
end
|
||||
|
||||
def send_devise_notification(notification, *args)
|
||||
|
12
app/services/ldap_manager/update_email.rb
Normal file
12
app/services/ldap_manager/update_email.rb
Normal file
@ -0,0 +1,12 @@
|
||||
module LdapManager
|
||||
class UpdateEmail < LdapManagerService
|
||||
def initialize(dn, address)
|
||||
@dn = dn
|
||||
@address = address
|
||||
end
|
||||
|
||||
def call
|
||||
replace_attribute @dn, :mail, [ @address ]
|
||||
end
|
||||
end
|
||||
end
|
2
app/services/ldap_manager_service.rb
Normal file
2
app/services/ldap_manager_service.rb
Normal file
@ -0,0 +1,2 @@
|
||||
class LdapManagerService < LdapService
|
||||
end
|
Loading…
x
Reference in New Issue
Block a user