class CrackLib::Fascist
Checks a given password and wraps the result. The password is checked when an instance is created (e.g. Fascist.new('my_bad_password')
). You can check the result with Fascist#ok?
. If the password is weak, the reason given is available in reason
.
Attributes
reason[R]
The reason why the checked password is weak.
Public Class Methods
new(pw, dict_path = CrackLib.default_dict)
click to toggle source
Checks the password pw
using the cracklib dictionary at dict_path
.
# File lib/cracklib.rb, line 47 def initialize(pw, dict_path = CrackLib.default_dict) @reason = CrackLib.FascistCheck(pw, dict_path) end
Public Instance Methods
ok?()
click to toggle source
Returns false if the checked password was found to be weak, true otherwise (but that doesn’t necessarily mean it’s a strong password).
# File lib/cracklib.rb, line 53 def ok? @reason.nil? end