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

Instance Method Summary collapse

Instance Attribute Details

#login_flowObject (readonly)

Login flow tool.



11
12
13
# File 'lib/dh_easy/login/plugin/enabled_behavior.rb', line 11

def 
  @login_flow
end

Instance Method Details

#fix_sessionBoolean

Fixes current page’s session.

Returns:

  • (Boolean)

    ‘true` when session is valid and no need to fix, else `false`.

Raises:

  • (NotImplementedError)


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.

Parameters:

  • opts (Hash) (defaults to: {})

    ({}) Configuration options (see DhEasy::Login::Flow#initialize_hook_login_flow).



17
18
19
# File 'lib/dh_easy/login/plugin/enabled_behavior.rb', line 17

def  opts = {}
  @login_flow = DhEasy::Login::Flow.new opts
end

#saltString

Generates a salt value based on the current page’s login flow vars.

Returns:

  • (String)


24
25
26
27
28
# File 'lib/dh_easy/login/plugin/enabled_behavior.rb', line 24

def salt
  old_cookie = page['vars'][.vars_key]
  old_cookie = '' if old_cookie.nil?
  Digest::SHA1.hexdigest old_cookie
end

#valid_session?Boolean

Validates that the current page’s session hasn’t expired.

Returns:

  • (Boolean)

    ‘true` when session is valid, else `false`.

Raises:

  • (NotImplementedError)


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