Class: Monban::Configuration
- Inherits:
-
Object
- Object
- Monban::Configuration
- Defined in:
- lib/monban/configuration.rb
Instance Attribute Summary collapse
-
#encryption_method ⇒ Object
Returns the value of attribute encryption_method.
-
#sign_in_notice ⇒ Object
Returns the value of attribute sign_in_notice.
-
#token_comparison ⇒ Object
Returns the value of attribute token_comparison.
-
#user_class ⇒ Object
Returns the value of attribute user_class.
-
#user_lookup_field ⇒ Object
Returns the value of attribute user_lookup_field.
-
#user_token_field ⇒ Object
Returns the value of attribute user_token_field.
-
#user_token_store_field ⇒ Object
Returns the value of attribute user_token_store_field.
Instance Method Summary collapse
- #default_encryption_method ⇒ Object
- #default_password_comparison ⇒ Object
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
7 8 9 10 11 12 13 14 15 |
# File 'lib/monban/configuration.rb', line 7 def initialize @user_class = 'User' @user_token_field = 'password' @user_token_store_field = 'password_digest' @user_lookup_field = 'email' @encryption_method = default_encryption_method @token_comparison = default_password_comparison @sign_in_notice = 'You must be signed in' end |
Instance Attribute Details
#encryption_method ⇒ Object
Returns the value of attribute encryption_method.
4 5 6 |
# File 'lib/monban/configuration.rb', line 4 def encryption_method @encryption_method end |
#sign_in_notice ⇒ Object
Returns the value of attribute sign_in_notice.
5 6 7 |
# File 'lib/monban/configuration.rb', line 5 def sign_in_notice @sign_in_notice end |
#token_comparison ⇒ Object
Returns the value of attribute token_comparison.
4 5 6 |
# File 'lib/monban/configuration.rb', line 4 def token_comparison @token_comparison end |
#user_class ⇒ Object
Returns the value of attribute user_class.
3 4 5 |
# File 'lib/monban/configuration.rb', line 3 def user_class @user_class end |
#user_lookup_field ⇒ Object
Returns the value of attribute user_lookup_field.
4 5 6 |
# File 'lib/monban/configuration.rb', line 4 def user_lookup_field @user_lookup_field end |
#user_token_field ⇒ Object
Returns the value of attribute user_token_field.
3 4 5 |
# File 'lib/monban/configuration.rb', line 3 def user_token_field @user_token_field end |
#user_token_store_field ⇒ Object
Returns the value of attribute user_token_store_field.
3 4 5 |
# File 'lib/monban/configuration.rb', line 3 def user_token_store_field @user_token_store_field end |
Instance Method Details
#default_encryption_method ⇒ Object
17 18 19 |
# File 'lib/monban/configuration.rb', line 17 def default_encryption_method ->(token) { BCrypt::Password.create(token) } end |
#default_password_comparison ⇒ Object
21 22 23 24 25 |
# File 'lib/monban/configuration.rb', line 21 def default_password_comparison ->(digest, unencrypted_token) do BCrypt::Password.new(digest) == unencrypted_token end end |