Class: ThinkFeelDoEngine::PasswordValidator

Inherits:
Object
  • Object
show all
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

Instance Method Summary collapse

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

#passwordObject (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_tokenObject (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

#personObject (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_valueObject



19
20
21
# File 'app/models/think_feel_do_engine/password_validator.rb', line 19

def entropy_value
  valid_entropy? ? calculate_entroy : 0
end