summaryrefslogtreecommitdiff
path: root/app/controllers/concerns/accepts_pending_invitations.rb
blob: cb66c1a055dde874a64c96da682ea1b6ac66c6f7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# frozen_string_literal: true

module AcceptsPendingInvitations
  extend ActiveSupport::Concern

  def accept_pending_invitations
    return unless resource.active_for_authentication?

    clear_stored_location_for_resource if resource.accept_pending_invitations!.any?
  end

  def clear_stored_location_for_resource
    session_key = stored_location_key_for(resource)

    session.delete(session_key)
  end
end