Class: ThinkFeelDoEngine::PasswordValidator
- Inherits:
-
Object
- Object
- ThinkFeelDoEngine::PasswordValidator
- Defined in:
- app/models/think_feel_do_engine/password_validator.rb
Overview
Users Participant and User password validations
Constant Summary collapse
- WEAK_PASSWORD_MESSAGE =
"is too weak"
- VALID_ENTROPY =
10
Instance Attribute Summary collapse
-
#password ⇒ Object
readonly
Returns the value of attribute password.
-
#password_token ⇒ Object
readonly
Returns the value of attribute password_token.
-
#person ⇒ Object
readonly
Returns the value of attribute person.
Instance Method Summary collapse
- #entropy_value ⇒ Object
-
#initialize(password:, password_token:) ⇒ PasswordValidator
constructor
A new instance of PasswordValidator.
Constructor Details
#initialize(password:, password_token:) ⇒ PasswordValidator
Returns a new instance of PasswordValidator.
13 14 15 16 17 |
# File 'app/models/think_feel_do_engine/password_validator.rb', line 13 def initialize(password:, password_token:) @password = password @password_token = password_token find_or_intialize_person end |
Instance Attribute Details
#password ⇒ Object (readonly)
Returns the value of attribute password.
8 9 10 |
# File 'app/models/think_feel_do_engine/password_validator.rb', line 8 def password @password end |
#password_token ⇒ Object (readonly)
Returns the value of attribute password_token.
8 9 10 |
# File 'app/models/think_feel_do_engine/password_validator.rb', line 8 def password_token @password_token end |
#person ⇒ Object (readonly)
Returns the value of attribute person.
8 9 10 |
# File 'app/models/think_feel_do_engine/password_validator.rb', line 8 def person @person end |
Instance Method Details
#entropy_value ⇒ Object
19 20 21 |
# File 'app/models/think_feel_do_engine/password_validator.rb', line 19 def entropy_value valid_entropy? ? calculate_entroy : 0 end |