diff --git a/src/main/java/com/covas/Entity/UsersEntity.java b/src/main/java/com/covas/Entity/UsersEntity.java index 4d707d5..ef8d610 100644 --- a/src/main/java/com/covas/Entity/UsersEntity.java +++ b/src/main/java/com/covas/Entity/UsersEntity.java @@ -49,6 +49,8 @@ public class UsersEntity extends PanacheEntityBase { public LocalDateTime updated_at; @ColumnDefault("null") public LocalDateTime deleted_at; + @ColumnDefault("null") + public LocalDateTime connected_at; public static UsersEntity findByPseudo(String pseudo){ return find("pseudo", pseudo).firstResult(); diff --git a/src/main/java/com/covas/Resources/TokenRessource.java b/src/main/java/com/covas/Resources/TokenRessource.java index b77b216..1b2bd20 100644 --- a/src/main/java/com/covas/Resources/TokenRessource.java +++ b/src/main/java/com/covas/Resources/TokenRessource.java @@ -2,6 +2,7 @@ package com.covas.Resources; import java.nio.charset.StandardCharsets; import java.time.Duration; +import java.time.LocalDateTime; import javax.inject.Inject; import javax.ws.rs.CookieParam; @@ -71,6 +72,8 @@ public class TokenRessource { // or create a JWT token encrypted using the 'A256KW' algorithm // Jwt.upn("alice").encryptWithSecret(secret); String nameEncoded = Base64.toBase64String(name.getBytes(StandardCharsets.UTF_8)); + users.connected_at = LocalDateTime.now(); + users.persist(); return Response.status(Response.Status.CREATED).cookie(new NewCookie(new Cookie("jwt", newJwtCookie), "Token JWT", expires, false), new NewCookie(new Cookie("user", nameEncoded), "Username", expires, false)).build(); } // All mp.jwt and smallrye.jwt properties are still effective, only the verification key is customized.