Module: Sorcery::Controller::Config

Defined in:
lib/sorcery/controller.rb

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.after_failed_loginObject

Returns the value of attribute after_failed_login.



140
141
142
# File 'lib/sorcery/controller.rb', line 140

def 
  @after_failed_login
end

.after_loginObject

Returns the value of attribute after_login.



140
141
142
# File 'lib/sorcery/controller.rb', line 140

def 
  @after_login
end

.after_logoutObject

Returns the value of attribute after_logout.



140
141
142
# File 'lib/sorcery/controller.rb', line 140

def after_logout
  @after_logout
end

.before_logoutObject

Returns the value of attribute before_logout.



140
141
142
# File 'lib/sorcery/controller.rb', line 140

def before_logout
  @before_logout
end

Returns the value of attribute cookie_domain.



140
141
142
# File 'lib/sorcery/controller.rb', line 140

def cookie_domain
  @cookie_domain
end

.login_sourcesObject

Returns the value of attribute login_sources.



140
141
142
# File 'lib/sorcery/controller.rb', line 140

def 
  @login_sources
end

.not_authenticated_actionObject

Returns the value of attribute not_authenticated_action.



140
141
142
# File 'lib/sorcery/controller.rb', line 140

def not_authenticated_action
  @not_authenticated_action
end

.save_return_to_urlObject

Returns the value of attribute save_return_to_url.



140
141
142
# File 'lib/sorcery/controller.rb', line 140

def save_return_to_url
  @save_return_to_url
end

.submodulesObject

Returns the value of attribute submodules.



140
141
142
# File 'lib/sorcery/controller.rb', line 140

def submodules
  @submodules
end

.user_classObject

Returns the value of attribute user_class.



140
141
142
# File 'lib/sorcery/controller.rb', line 140

def user_class
  @user_class
end

Class Method Details

.configure(&blk) ⇒ Object



188
189
190
# File 'lib/sorcery/controller.rb', line 188

def configure(&blk)
  @configure_blk = blk
end

.configure!Object



192
193
194
# File 'lib/sorcery/controller.rb', line 192

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

.init!Object



156
157
158
159
160
161
162
163
164
165
166
167
168
169
# File 'lib/sorcery/controller.rb', line 156

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.



172
173
174
175
176
# File 'lib/sorcery/controller.rb', line 172

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

.update!Object



178
179
180
181
182
# File 'lib/sorcery/controller.rb', line 178

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

.user_config(&blk) ⇒ Object



184
185
186
# File 'lib/sorcery/controller.rb', line 184

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