Class: Aker::Form::Middleware::LogoutResponder

Inherits:
Object
  • Object
show all
Includes:
LoginFormAssetProvider, Rack::ConfigurationHelper
Defined in:
lib/aker/form/middleware/logout_responder.rb

Instance Method Summary (collapse)

Methods included from Rack::ConfigurationHelper

#using_custom_login_page?, #using_custom_logout_page?

Methods included from Rack::EnvironmentHelper

#authority, #configuration, #interactive?

Methods included from LoginFormAssetProvider

#asset_root, #login_css, #login_html

Constructor Details

- (LogoutResponder) initialize(app)



8
9
10
# File 'lib/aker/form/middleware/logout_responder.rb', line 8

def initialize(app)
  @app = app
end

Instance Method Details

- (Object) call(env)

When given GET /logout without the :using_custom_logout_page :form parameter set, builds a Rack response containing the login form with a "you have been logged out" notification. Otherwise, passes the response on.



19
20
21
22
23
24
25
26
27
# File 'lib/aker/form/middleware/logout_responder.rb', line 19

def call(env)
  return @app.call(env) if using_custom_logout_page?(env)

  if env['REQUEST_METHOD'] == 'GET' && env['PATH_INFO'] == '/logout'
    ::Rack::Response.new((env, :logged_out => true)).finish
  else
    @app.call(env)
  end
end