This commit is contained in:
Mathieu Magnin 2024-09-17 09:47:46 +02:00
parent 539853255d
commit 7ace670010
No known key found for this signature in database
GPG key ID: 8DCAFC82D7BA654E

View file

@ -7,7 +7,8 @@ class JwtField < Administrate::Field::Base
if data.present?
begin
decoded_token = JWT.decode(data, nil, false)
expiration = Time.zone.at(decoded_token[0]['exp'])
return "Token présent, sans expiration" unless decoded_token[0].key?('exp')
if expiration < Time.zone.now
"Token présent, expiré le #{expiration.strftime('%d/%m/%Y à %H:%M')}"