diff --git a/src/main/java/fr/eni/enchere/controllers/EnchereController.java b/src/main/java/fr/eni/enchere/controllers/EnchereController.java
index 0359e26..155ee41 100644
--- a/src/main/java/fr/eni/enchere/controllers/EnchereController.java
+++ b/src/main/java/fr/eni/enchere/controllers/EnchereController.java
@@ -43,7 +43,9 @@ public class EnchereController {
//Empeche une enchere inférieur au prix de base de l'article
Article article = this.articleService.findArticleById(articleId);
- if (enchere.getMontantEnchere() < article.getPrixInitial()) {
+ float articlePrice = article.getPrixInitial();
+ float encherePrice = enchere.getMontantEnchere();
+ if (encherePrice < articlePrice) {
result.rejectValue("montantEnchere", "error.enchere", "Vous ne pouvez pas enchérir un montant inférieur au prix initial");
}
@@ -53,10 +55,14 @@ public class EnchereController {
.map(Enchere::getMontantEnchere) // Récupère seulement les montants d'enchère
.max(Float::compareTo);
System.out.println(maxMontantEnchere);
- if (enchere.getMontantEnchere() < maxMontantEnchere.get()) {
+ if (maxMontantEnchere.isPresent() && encherePrice < maxMontantEnchere.get()) {
result.rejectValue("montantEnchere", "error.enchere", "Vous ne pouvez pas enchérir un montant inférieur à la dernière enchère");
}
+ if (result.hasErrors()) {
+ return "redirect:/article/show?id=" + articleId;
+ }
+
this.enchereService.setEnchere(enchere);
return "redirect:/article/show?id=" + articleId;
}
diff --git a/src/main/java/fr/eni/enchere/controllers/InscriptionController.java b/src/main/java/fr/eni/enchere/controllers/InscriptionController.java
index 8fb719f..eb3d513 100644
--- a/src/main/java/fr/eni/enchere/controllers/InscriptionController.java
+++ b/src/main/java/fr/eni/enchere/controllers/InscriptionController.java
@@ -125,7 +125,7 @@ public class InscriptionController {
result.rejectValue("password", "error.userProfile", "Les mots de passe ne correspond pas.");
}
// Vérifier si le mot de passe est sécurisé
- String passwordRegex = "^(?=.*[0-9])(?=.*[a-z])(?=.*[A-Z])(?=.*[@#$%^&+=])(?=\\S+$).{8,}$";
+ String passwordRegex = "^(?=.*[0-9])(?=.*[a-z])(?=.*[A-Z])(?=.*[@?*#$%^&+=_!\\-])(?=\\S+$).{8,}$";
Pattern pattern = Pattern.compile(passwordRegex);
// Vérifier si le mot de passe correspond à l'expression régulière
if (!pattern.matcher(userProfile.getPassword()).matches()){
diff --git a/src/main/resources/templates/article.html b/src/main/resources/templates/article.html
index be2dbe7..5487395 100644
--- a/src/main/resources/templates/article.html
+++ b/src/main/resources/templates/article.html
@@ -50,6 +50,11 @@
+
+
+
+
+
diff --git a/src/main/resources/templates/inscription.html b/src/main/resources/templates/inscription.html
index f07df47..9914690 100644
--- a/src/main/resources/templates/inscription.html
+++ b/src/main/resources/templates/inscription.html
@@ -100,10 +100,10 @@
-
-
-
-
+