add expire 5 minutes for mail

This commit is contained in:
Valentin CZERYBA 2022-06-27 23:05:17 +02:00
parent 5ac8443304
commit de5990fa62

View File

@ -16,7 +16,6 @@ import com.covas.Entity.UsersEntity;
import io.quarkus.mailer.MailTemplate;
import io.quarkus.redis.client.RedisClient;
import org.jboss.logging.Logger;
@Path("mail")
public class MailRessource {
@ -35,6 +34,7 @@ public class MailRessource {
}
String randomKey=UUID.randomUUID().toString();
redisClient.set(Arrays.asList(users.id.toString(),randomKey));
redisClient.expire(users.id.toString(), "300");
mailer.to(users.email).subject(String.format("Compte %s créée", users.email)).data("name", users.pseudo).data("id",users.id).data("key",randomKey).send().subscribeAsCompletionStage();
return Response.ok().build();
}