From 61c3ff54d5d0c80e37294ab314cb18eb3e6f4e54 Mon Sep 17 00:00:00 2001 From: Nicolas Cavigneaux Date: Wed, 15 Mar 2023 17:22:55 +0100 Subject: [PATCH] fix: JWT token custom validation --- app/validators/jwt_token_validator.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/validators/jwt_token_validator.rb b/app/validators/jwt_token_validator.rb index ec1ca427d..031a9d1ab 100644 --- a/app/validators/jwt_token_validator.rb +++ b/app/validators/jwt_token_validator.rb @@ -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