Module: DhEasy::Login::Plugin::EnabledBehavior Abstract
- Includes:
- Core::Plugin::InitializeHook
- Defined in:
- lib/dh_easy/login/plugin/enabled_behavior.rb
Overview
This module is abstract.
Abstract module that provides a template with minimal common logic to
implement a login flow enabled plugin.
Instance Attribute Summary collapse
-
#login_flow ⇒ Object
readonly
Login flow tool.
Instance Method Summary collapse
-
#fix_session ⇒ Boolean
Fixes current page’s session.
-
#initialize_hook_login_plugin_enabled_behavior(opts = {}) ⇒ Object
Hook to initialize login_flow configuration.
-
#salt ⇒ String
Generates a salt value based on the current page’s login flow vars.
-
#valid_session? ⇒ Boolean
Validates that the current page’s session hasn’t expired.
Instance Attribute Details
#login_flow ⇒ Object (readonly)
Login flow tool.
11 12 13 |
# File 'lib/dh_easy/login/plugin/enabled_behavior.rb', line 11 def login_flow @login_flow end |
Instance Method Details
#fix_session ⇒ Boolean
Fixes current page’s session.
41 42 43 |
# File 'lib/dh_easy/login/plugin/enabled_behavior.rb', line 41 def fix_session raise NotImplementedError.new('Must implement "fix_session" function.') end |
#initialize_hook_login_plugin_enabled_behavior(opts = {}) ⇒ Object
Hook to initialize login_flow configuration.
17 18 19 |
# File 'lib/dh_easy/login/plugin/enabled_behavior.rb', line 17 def initialize_hook_login_plugin_enabled_behavior opts = {} @login_flow = DhEasy::Login::Flow.new opts end |
#salt ⇒ String
Generates a salt value based on the current page’s login flow vars.
24 25 26 27 28 |
# File 'lib/dh_easy/login/plugin/enabled_behavior.rb', line 24 def salt = page['vars'][login_flow.vars_key] = '' if .nil? Digest::SHA1.hexdigest end |
#valid_session? ⇒ Boolean
Validates that the current page’s session hasn’t expired.
33 34 35 |
# File 'lib/dh_easy/login/plugin/enabled_behavior.rb', line 33 def valid_session? raise NotImplementedError.new('Must implement "session_valid?" function.') end |