Module: IntercomApp::LoginProtection
- Extended by:
- ActiveSupport::Concern
- Defined in:
- lib/intercom-app/login_protection.rb
Instance Method Summary collapse
- #app_session ⇒ Object
-
#intercom_session ⇒ Object
included do rescue_from ActiveResource::UnauthorizedAccess, :with => :close_session end.
Instance Method Details
#app_session ⇒ Object
20 21 22 23 |
# File 'lib/intercom-app/login_protection.rb', line 20 def app_session return unless session[:intercom] @intercom_session ||= IntercomApp::SessionRepository.retrieve(session[:intercom]) end |
#intercom_session ⇒ Object
included do
rescue_from ActiveResource::UnauthorizedAccess, :with => :close_session
end
9 10 11 12 13 14 15 16 17 18 |
# File 'lib/intercom-app/login_protection.rb', line 9 def intercom_session if app_session begin @intercom_client = Intercom::Client.new(app_id: app_session[:token], api_key: '') yield end else redirect_to_login end end |