2018-09-14 01:42:05 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2018-05-17 05:19:47 -04:00
|
|
|
module AcceptsPendingInvitations
|
|
|
|
extend ActiveSupport::Concern
|
|
|
|
|
|
|
|
def accept_pending_invitations
|
|
|
|
return unless resource.active_for_authentication?
|
|
|
|
|
2021-05-11 14:10:36 -04:00
|
|
|
if resource.pending_invitations.load.any?
|
|
|
|
resource.accept_pending_invitations!
|
2021-04-29 17:10:03 -04:00
|
|
|
clear_stored_location_for_resource
|
|
|
|
after_pending_invitations_hook
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def after_pending_invitations_hook
|
|
|
|
# no-op
|
2018-05-17 05:19:47 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
def clear_stored_location_for_resource
|
|
|
|
session_key = stored_location_key_for(resource)
|
|
|
|
|
|
|
|
session.delete(session_key)
|
|
|
|
end
|
|
|
|
end
|