fix: JWT token custom validation

This commit is contained in:
Nicolas Cavigneaux 2023-03-15 17:22:55 +01:00 committed by Colin Darie
parent 06296e933a
commit 61c3ff54d5
No known key found for this signature in database
GPG key ID: 4FB865FDBCA4BCC4

View file

@ -3,7 +3,7 @@ class JwtTokenValidator < ActiveModel::EachValidator
begin
JWT.decode value, nil, false
rescue
record.errors[attribute] << (options[:message] || "n'est pas un jeton valide")
record.errors.add attribute, :invalid, message: (options[:message] || "n'est pas un jeton valide")
end
end
end