Module: Sorcery::Controller::Config

Defined in:
lib/sorcery/controller/config.rb

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.after_failed_loginObject

Returns the value of attribute after_failed_login.



5
6
7
# File 'lib/sorcery/controller/config.rb', line 5

def 
  @after_failed_login
end

.after_loginObject

Returns the value of attribute after_login.



5
6
7
# File 'lib/sorcery/controller/config.rb', line 5

def 
  @after_login
end

.after_logoutObject

Returns the value of attribute after_logout.



5
6
7
# File 'lib/sorcery/controller/config.rb', line 5

def after_logout
  @after_logout
end

.before_logoutObject

Returns the value of attribute before_logout.



5
6
7
# File 'lib/sorcery/controller/config.rb', line 5

def before_logout
  @before_logout
end

Returns the value of attribute cookie_domain.



5
6
7
# File 'lib/sorcery/controller/config.rb', line 5

def cookie_domain
  @cookie_domain
end

.login_sourcesObject

Returns the value of attribute login_sources.



5
6
7
# File 'lib/sorcery/controller/config.rb', line 5

def 
  @login_sources
end

.not_authenticated_actionObject

Returns the value of attribute not_authenticated_action.



5
6
7
# File 'lib/sorcery/controller/config.rb', line 5

def not_authenticated_action
  @not_authenticated_action
end

.save_return_to_urlObject

Returns the value of attribute save_return_to_url.



5
6
7
# File 'lib/sorcery/controller/config.rb', line 5

def save_return_to_url
  @save_return_to_url
end

.submodulesObject

Returns the value of attribute submodules.



5
6
7
# File 'lib/sorcery/controller/config.rb', line 5

def submodules
  @submodules
end

.user_classObject

Returns the value of attribute user_class.



5
6
7
# File 'lib/sorcery/controller/config.rb', line 5

def user_class
  @user_class
end

Class Method Details

.configure(&blk) ⇒ Object



53
54
55
# File 'lib/sorcery/controller/config.rb', line 53

def configure(&blk)
  @configure_blk = blk
end

.configure!Object



57
58
59
# File 'lib/sorcery/controller/config.rb', line 57

def configure!
  @configure_blk.call(self) if @configure_blk
end

.init!Object



21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/sorcery/controller/config.rb', line 21

def init!
  @defaults = {
    :@user_class                           => nil,
    :@submodules                           => [],
    :@not_authenticated_action             => :not_authenticated,
    :@login_sources                        => [],
    :@after_login                          => [],
    :@after_failed_login                   => [],
    :@before_logout                        => [],
    :@after_logout                         => [],
    :@save_return_to_url                   => true,
    :@cookie_domain                        => nil
  }
end

.reset!Object

Resets all configuration options to their default values.



37
38
39
40
41
# File 'lib/sorcery/controller/config.rb', line 37

def reset!
  @defaults.each do |k,v|
    instance_variable_set(k,v)
  end
end

.update!Object



43
44
45
46
47
# File 'lib/sorcery/controller/config.rb', line 43

def update!
  @defaults.each do |k,v|
    instance_variable_set(k,v) if !instance_variable_defined?(k)
  end
end

.user_config(&blk) ⇒ Object



49
50
51
# File 'lib/sorcery/controller/config.rb', line 49

def user_config(&blk)
  block_given? ? @user_config = blk : @user_config
end