Class: BetterAuthy::ScopeConfiguration
- Inherits:
-
Object
- Object
- BetterAuthy::ScopeConfiguration
- Defined in:
- lib/better_authy/scope_configuration.rb
Instance Attribute Summary collapse
-
#after_sign_in_path ⇒ Object
Returns the value of attribute after_sign_in_path.
-
#enable_sign_up ⇒ Object
Returns the value of attribute enable_sign_up.
-
#layout ⇒ Object
Returns the value of attribute layout.
-
#model_name ⇒ Object
Returns the value of attribute model_name.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#password_reset_within ⇒ Object
Returns the value of attribute password_reset_within.
-
#remember_cookie ⇒ Object
Returns the value of attribute remember_cookie.
-
#remember_for ⇒ Object
Returns the value of attribute remember_for.
-
#session_key ⇒ Object
Returns the value of attribute session_key.
-
#sign_in_path ⇒ Object
Returns the value of attribute sign_in_path.
Instance Method Summary collapse
-
#initialize(name) ⇒ ScopeConfiguration
constructor
A new instance of ScopeConfiguration.
- #model_class ⇒ Object
- #sign_up_enabled? ⇒ Boolean
- #validate! ⇒ Object
Constructor Details
#initialize(name) ⇒ ScopeConfiguration
Returns a new instance of ScopeConfiguration.
10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/better_authy/scope_configuration.rb', line 10 def initialize(name) @name = name.to_sym @session_key = :"#{name}_id" @remember_cookie = :"_remember_#{name}_token" @remember_for = 2.weeks @password_reset_within = 1.hour @sign_in_path = "/auth/#{name}/login" @after_sign_in_path = "/" @layout = "better_authy/application" @enable_sign_up = true end |
Instance Attribute Details
#after_sign_in_path ⇒ Object
Returns the value of attribute after_sign_in_path.
6 7 8 |
# File 'lib/better_authy/scope_configuration.rb', line 6 def after_sign_in_path @after_sign_in_path end |
#enable_sign_up ⇒ Object
Returns the value of attribute enable_sign_up.
6 7 8 |
# File 'lib/better_authy/scope_configuration.rb', line 6 def enable_sign_up @enable_sign_up end |
#layout ⇒ Object
Returns the value of attribute layout.
6 7 8 |
# File 'lib/better_authy/scope_configuration.rb', line 6 def layout @layout end |
#model_name ⇒ Object
Returns the value of attribute model_name.
6 7 8 |
# File 'lib/better_authy/scope_configuration.rb', line 6 def model_name @model_name end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
5 6 7 |
# File 'lib/better_authy/scope_configuration.rb', line 5 def name @name end |
#password_reset_within ⇒ Object
Returns the value of attribute password_reset_within.
6 7 8 |
# File 'lib/better_authy/scope_configuration.rb', line 6 def password_reset_within @password_reset_within end |
#remember_cookie ⇒ Object
Returns the value of attribute remember_cookie.
6 7 8 |
# File 'lib/better_authy/scope_configuration.rb', line 6 def @remember_cookie end |
#remember_for ⇒ Object
Returns the value of attribute remember_for.
6 7 8 |
# File 'lib/better_authy/scope_configuration.rb', line 6 def remember_for @remember_for end |
#session_key ⇒ Object
Returns the value of attribute session_key.
6 7 8 |
# File 'lib/better_authy/scope_configuration.rb', line 6 def session_key @session_key end |
#sign_in_path ⇒ Object
Returns the value of attribute sign_in_path.
6 7 8 |
# File 'lib/better_authy/scope_configuration.rb', line 6 def sign_in_path @sign_in_path end |
Instance Method Details
#model_class ⇒ Object
26 27 28 29 30 |
# File 'lib/better_authy/scope_configuration.rb', line 26 def model_class raise ConfigurationError, "model_name is required for scope :#{name}" if model_name.blank? model_name.constantize end |
#sign_up_enabled? ⇒ Boolean
22 23 24 |
# File 'lib/better_authy/scope_configuration.rb', line 22 def sign_up_enabled? @enable_sign_up end |
#validate! ⇒ Object
32 33 34 |
# File 'lib/better_authy/scope_configuration.rb', line 32 def validate! raise ConfigurationError, "model_name is required for scope :#{name}" if model_name.blank? end |