submitting empty user form doest raise an error

This commit is contained in:
Aaro Koivukangas
2023-08-11 17:52:36 +03:00
parent e4b2bbbfd9
commit 169037ea17
+1 -1
View File
@@ -14,7 +14,7 @@ class User < ApplicationRecord
def has_proper_characters_in_password
regex = "(?=.*[[:upper:]])(?=.*[0-9])"
if not password.match(regex)
if not password&.match(regex)
errors.add :password, "doesn't contain uppercase letter and a number"
end
end