Module: Glib::Auth::Response

Extended by:
ActiveSupport::Concern
Defined in:
app/controllers/concerns/glib/auth/response.rb

Overview

Keep this module small because it needs to be compatible with Devise::FailureApp, which is not a Rails controller.

Instance Method Summary collapse

Instance Method Details

#glib_json_dialog_mode?Boolean

Returns:

  • (Boolean)


10
11
12
# File 'app/controllers/concerns/glib/auth/response.rb', line 10

def glib_json_dialog_mode?
  params[:_dialog].present? # E.g. _dialog=v1
end

#json_ui_401_response(sign_in_url) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'app/controllers/concerns/glib/auth/response.rb', line 14

def json_ui_401_response()
  {
    # Handle dialogs_open and windows_open
    glib_json_dialog_mode? ? :onLoad : :onResponse => __glib_error_dialog(
      'Your session has ended', 'Please re-login.', [
      {
        view: 'spacer',
        height: 20
      },
      {
        view: 'button',
        text: 'Re-login',
        onClick: {
          action: 'dialogs/close',
          onClose: {
            action: 'windows/open',
            url: 
          }
        }
      },
    ])
  }
end