Class: Aker::Form::Middleware::LoginResponder
- Inherits:
-
Object
- Object
- Aker::Form::Middleware::LoginResponder
- 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.
Instance Attribute Summary (collapse)
-
- (String) login_path
The path at which the middleware will watch for login requests.
Instance Method Summary (collapse)
-
- (Object) call(env)
Rack entry point.
-
- (LoginResponder) initialize(app, login_path)
constructor
Instantiates the middleware.
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
- (LoginResponder) initialize(app, login_path)
Instantiates the middleware.
27 28 29 30 |
# File 'lib/aker/form/middleware/login_responder.rb', line 27 def initialize(app, login_path) @app = app self.login_path = login_path end |
Instance Attribute Details
- (String) login_path
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 @login_path end |
Instance Method Details
- (Object) call(env)
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', login_path]; respond(env) else @app.call(env) end end |