feat: simplify SportEasy invitation email to use direct category link
AS Talange CI/CD Pipeline / Build & Run Unit Tests (push) Successful in 4m33s
AS Talange CI/CD Pipeline / Deploy to Test Environment (push) Successful in 6m36s

This commit is contained in:
2026-08-06 22:15:08 +02:00
parent 1a49216b02
commit c40f70e6b3
2 changed files with 22 additions and 11 deletions
@@ -67,13 +67,16 @@ public class SportEasyEmailService {
? licence.getCategorie().getSportEasyToken().trim() ? licence.getCategorie().getSportEasyToken().trim()
: ""; : "";
if (token.isEmpty()) {
throw new IllegalStateException("Le lien d'invitation SportEasy n'a pas été renseigné pour la catégorie "
+ (licence.getCategorie() != null ? licence.getCategorie().getNom() : "") + ".");
}
String inviteUrl; String inviteUrl;
if (token.startsWith("http://") || token.startsWith("https://")) { if (token.startsWith("http://") || token.startsWith("https://")) {
inviteUrl = token; inviteUrl = token;
} else if (!token.isEmpty()) {
inviteUrl = sportEasyBaseUrl.endsWith("/") ? sportEasyBaseUrl + token : sportEasyBaseUrl + "/" + token;
} else { } else {
inviteUrl = sportEasyBaseUrl; inviteUrl = sportEasyBaseUrl.endsWith("/") ? sportEasyBaseUrl + token : sportEasyBaseUrl + "/" + token;
} }
String adherentNom = licence.getAdherent().getPrenom() + " " + licence.getAdherent().getNom(); String adherentNom = licence.getAdherent().getPrenom() + " " + licence.getAdherent().getNom();
@@ -193,6 +196,7 @@ public class SportEasyEmailService {
.header h1 { margin: 0; font-size: 22px; } .header h1 { margin: 0; font-size: 22px; }
.content { padding: 24px; line-height: 1.6; } .content { padding: 24px; line-height: 1.6; }
.btn { display: inline-block; background-color: #2563eb; color: #ffffff !important; padding: 12px 24px; border-radius: 6px; text-decoration: none; font-weight: bold; margin-top: 16px; text-align: center; } .btn { display: inline-block; background-color: #2563eb; color: #ffffff !important; padding: 12px 24px; border-radius: 6px; text-decoration: none; font-weight: bold; margin-top: 16px; text-align: center; }
.url-box { background: #f3f4f6; border: 1px solid #e5e7eb; border-radius: 6px; padding: 12px; margin-top: 16px; font-size: 13px; word-break: break-all; color: #1f2937; }
.footer { background: #f9fafb; border-top: 1px solid #e5e7eb; padding: 16px; text-align: center; font-size: 12px; color: #6b7280; } .footer { background: #f9fafb; border-top: 1px solid #e5e7eb; padding: 16px; text-align: center; font-size: 12px; color: #6b7280; }
</style> </style>
</head> </head>
@@ -203,13 +207,18 @@ public class SportEasyEmailService {
</div> </div>
<div class="content"> <div class="content">
<p>Bonjour <strong>%s</strong>,</p> <p>Bonjour <strong>%s</strong>,</p>
<p>Afin d'assurer le suivi des entraînements, convocations et matchs pour la saison <strong>%s</strong> (catégorie <strong>%s</strong>), le club utilise la plateforme <strong>SportEasy</strong>.</p> <p>Afin d'assurer le suivi des entraînements, convocations et matchs pour la saison <strong>%s</strong> (catégorie <strong>%s</strong>), merci de rejoindre l'équipe sur la plateforme <strong>SportEasy</strong> en cliquant sur le lien ci-dessous :</p>
<p>Merci de rejoindre le groupe de votre catégorie en cliquant sur le bouton ci-dessous :</p>
<p style="text-align: center;"> <p style="text-align: center;">
<a href="%s" class="btn" target="_blank">Rejoindre l'équipe SportEasy</a> <a href="%s" class="btn" target="_blank">Rejoindre la catégorie sur SportEasy</a>
</p> </p>
<p>Si vous possédez déjà un compte SportEasy, connectez-vous avec vos identifiants puis rejoignez le groupe. Sinon, créez votre compte gratuitement en quelques secondes.</p>
<p>À très vite sur les terrains !<br><strong>L'équipe de l'AS Talange</strong></p> <div class="url-box">
<strong>Lien d'invitation direct :</strong><br>
<a href="%s" style="color: #2563eb;">%s</a>
</div>
<p style="margin-top: 20px;">À très vite sur les terrains !<br><strong>L'équipe de l'AS Talange</strong></p>
</div> </div>
<div class="footer"> <div class="footer">
Cet e-mail a été envoyé automatiquement par le système de gestion de l'AS Talange. Cet e-mail a été envoyé automatiquement par le système de gestion de l'AS Talange.
@@ -221,6 +230,8 @@ public class SportEasyEmailService {
adherentNom, adherentNom,
saisonNom != null ? saisonNom : "", saisonNom != null ? saisonNom : "",
categorieNom, categorieNom,
inviteUrl,
inviteUrl,
inviteUrl inviteUrl
); );
} }
@@ -65,10 +65,10 @@
</div> </div>
<div> <div>
<label for="sportEasyToken" class="block text-sm font-medium text-gray-700 mb-1">Token ou Lien d'invitation SportEasy</label> <label for="sportEasyToken" class="block text-sm font-medium text-gray-700 mb-1">Lien d'invitation SportEasy de la catégorie</label>
<input type="text" id="sportEasyToken" th:field="*{sportEasyToken}" placeholder="ex: https://www.sporteasy.net/join/ABC1234 ou juste ABC1234" <input type="text" id="sportEasyToken" th:field="*{sportEasyToken}" placeholder="ex: https://www.sporteasy.net/join/XXXXXX"
class="w-full border border-gray-300 rounded-lg px-4 py-2 text-sm focus:ring-2 focus:ring-blue-500 focus:border-blue-500 outline-none transition-colors"> class="w-full border border-gray-300 rounded-lg px-4 py-2 text-sm focus:ring-2 focus:ring-blue-500 focus:border-blue-500 outline-none transition-colors">
<p class="text-xs text-gray-500 mt-1">Saisissez le token du groupe SportEasy ou l'URL complète d'invitation.</p> <p class="text-xs text-gray-500 mt-1">Saisissez le lien direct d'invitation SportEasy spécifique à cette catégorie.</p>
</div> </div>
<div class="pt-4 border-t border-gray-100"> <div class="pt-4 border-t border-gray-100">