10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
# File 'app/validators/password_is_strong_validator.rb', line 10
def validate_each(record, attribute, value)
return if value.blank?
if is_simple?(value)
record.errors[attribute] << "must contain letters, numbers, and at least one special character"
end
if contains_username?(record.username, value)
record.errors[attribute] << "must not contain the username"
end
if is_common_password?(value)
record.errors[attribute] << "must not be a common password"
end
if contains_repetition?(value)
record.errors[attribute] << "must not be a predictable sequence of characters"
end
end
|