Class: Aker::Form::Middleware::LoginResponder

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

Overview

Rack middleware used by Aker::Form::Mode that finishes login requests by rendering a "Login successful" message.

This middleware implements half of the form login process. The other half is implemented by LoginRenderer.

Author:

  • David Yip

Instance Attribute Summary collapse

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

#initialize(app, login_path) ⇒ LoginResponder

Instantiates the middleware.



27
28
29
30
# File 'lib/aker/form/middleware/login_responder.rb', line 27

def initialize(app, )
  @app = app
  self. = 
end

Instance Attribute Details

#login_pathString

The path at which the middleware will watch for login requests.



19
20
21
# File 'lib/aker/form/middleware/login_responder.rb', line 19

def 
  @login_path
end

Instance Method Details

#call(env) ⇒ Object

Rack entry point. Responds to POST /login.

If the user is authenticated and a URL is given in the url parameter, then this action will redirect to url.



40
41
42
43
44
45
# File 'lib/aker/form/middleware/login_responder.rb', line 40

def call(env)
  case [env['REQUEST_METHOD'], env['PATH_INFO']]
    when ['POST', ]; respond(env)
    else @app.call(env)
  end
end