Class: NOBSPW::PasswordChecker
- Inherits:
-
Object
- Object
- NOBSPW::PasswordChecker
show all
- Includes:
- ValidationMethods
- Defined in:
- lib/nobspw/password_checker.rb
Constant Summary
ValidationMethods::DEFAULT_VALIDATION_METHODS
Instance Method Summary
collapse
Constructor Details
#initialize(name: nil, username: nil, email: nil, password:) ⇒ PasswordChecker
Returns a new instance of PasswordChecker.
5
6
7
8
9
10
|
# File 'lib/nobspw/password_checker.rb', line 5
def initialize(name: nil, username: nil, email: nil, password:)
@name, @username, @email, @password = \
name&.strip, username&.strip, email&.strip, password&.strip
raise ArgumentError.new("Password was not specified.") if password.nil? || password.strip.length == 0
end
|
Instance Method Details
#strong? ⇒ Boolean
12
13
14
15
|
# File 'lib/nobspw/password_checker.rb', line 12
def strong?
check_password if @strong.nil?
@strong
end
|
#weak? ⇒ Boolean
17
18
19
|
# File 'lib/nobspw/password_checker.rb', line 17
def weak?
!strong?
end
|
#weak_password_reasons ⇒ Object
Also known as:
reasons
21
22
23
24
|
# File 'lib/nobspw/password_checker.rb', line 21
def weak_password_reasons
check_password if @weak_password_reasons.nil?
@weak_password_reasons
end
|