From 067920189fd5ffb9ea73c9ed0d066d8f44066cdc Mon Sep 17 00:00:00 2001 From: mepiphana2023 Date: Wed, 24 Apr 2024 11:19:28 +0200 Subject: [PATCH 1/2] fichier langue / bootstrap --- .../java/fr/eni/enchere/config/WebConfig.java | 2 +- .../enchere/security/WebSecurityConfig.java | 2 +- src/main/resources/application.properties | 3 +- .../resources/i18n/messages_fr.properties | 2 +- src/main/resources/templates/profil.html | 96 +++++++++++-------- 5 files changed, 59 insertions(+), 46 deletions(-) diff --git a/src/main/java/fr/eni/enchere/config/WebConfig.java b/src/main/java/fr/eni/enchere/config/WebConfig.java index ce572cd..623bde6 100644 --- a/src/main/java/fr/eni/enchere/config/WebConfig.java +++ b/src/main/java/fr/eni/enchere/config/WebConfig.java @@ -16,7 +16,7 @@ public class WebConfig { @Bean public LocaleResolver localeResolver() { SessionLocaleResolver resolver = new SessionLocaleResolver(); - resolver.setDefaultLocale(Locale.FRENCH); // Définit la locale par défaut + resolver.setDefaultLocale(Locale.FRENCH); return resolver; } diff --git a/src/main/java/fr/eni/enchere/security/WebSecurityConfig.java b/src/main/java/fr/eni/enchere/security/WebSecurityConfig.java index d08bf58..12b7785 100644 --- a/src/main/java/fr/eni/enchere/security/WebSecurityConfig.java +++ b/src/main/java/fr/eni/enchere/security/WebSecurityConfig.java @@ -19,7 +19,7 @@ public class WebSecurityConfig{ .requestMatchers("/", "/accueil").permitAll() .requestMatchers("/accueil", "/login", "/inscription/**", "/searchArticle", "/article/**", "/change-language").permitAll() .requestMatchers("/css/**", "/images/**", "/assets/**", "/img/**", "/js/**").permitAll() - .requestMatchers("/profil/**", "/article/new/**", "/article/update", "/article/delete").authenticated() + .requestMatchers("/profil/**", "/article/new/**").authenticated() .requestMatchers("/admin").hasRole("ADMIN") .anyRequest().authenticated()) .formLogin((form) -> form.loginPage("/login").defaultSuccessUrl("/", true)) diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index e332b8d..4fcf5b8 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -1,4 +1,5 @@ spring.datasource.url=jdbc:mariadb://91.121.54.36:3306/eni_enchere spring.datasource.username=eni spring.datasource.password=Pa$$w0rd -spring.datasource.driver-class-name=org.mariadb.jdbc.Driver \ No newline at end of file +spring.datasource.driver-class-name=org.mariadb.jdbc.Driver +spring.messages.encoding=UTF-8 \ No newline at end of file diff --git a/src/main/resources/i18n/messages_fr.properties b/src/main/resources/i18n/messages_fr.properties index de19788..d57e581 100644 --- a/src/main/resources/i18n/messages_fr.properties +++ b/src/main/resources/i18n/messages_fr.properties @@ -1,3 +1,3 @@ accueil.search.title = Rechercher un article par nom... -accueil.search.cat = Toutes les catégories +accueil.search.cat = Toutes les cat\u00e9gories accueil.search.button = Recherche \ No newline at end of file diff --git a/src/main/resources/templates/profil.html b/src/main/resources/templates/profil.html index ffaed00..e489788 100644 --- a/src/main/resources/templates/profil.html +++ b/src/main/resources/templates/profil.html @@ -3,48 +3,60 @@ - -
-

Mon profil

-
- - + +
+
+
+
+
+

Mon profil

+
+
+
    +
  • + + +
  • +
  • + + +
  • +
  • + + +
  • +
  • + + +
  • +
  • + + +
  • +
  • + + +
  • +
  • + + +
  • +
  • + + +
  • +
  • + + +
  • +
+
+ +
+
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- -
- +
+
+ From 666416d2f35614751c0d2f842f45351dce50c0ad Mon Sep 17 00:00:00 2001 From: mepiphana2023 Date: Wed, 24 Apr 2024 12:15:04 +0200 Subject: [PATCH 2/2] fichier langue / bootstrap --- .../enchere/controllers/LoginController.java | 5 - .../enchere/security/WebSecurityConfig.java | 13 +- .../resources/i18n/messages_fr.properties | 43 ++- src/main/resources/templates/editProfil.html | 253 ++++++++---------- src/main/resources/templates/modele-page.html | 2 +- src/main/resources/templates/profil.html | 22 +- 6 files changed, 172 insertions(+), 166 deletions(-) diff --git a/src/main/java/fr/eni/enchere/controllers/LoginController.java b/src/main/java/fr/eni/enchere/controllers/LoginController.java index b81fb7f..dcd0ce7 100644 --- a/src/main/java/fr/eni/enchere/controllers/LoginController.java +++ b/src/main/java/fr/eni/enchere/controllers/LoginController.java @@ -34,9 +34,4 @@ public class LoginController { return "redirect:/security/login?error"; } } - - @GetMapping("/logout") - public String logout(Model modele) { - return "security/logout"; - } } diff --git a/src/main/java/fr/eni/enchere/security/WebSecurityConfig.java b/src/main/java/fr/eni/enchere/security/WebSecurityConfig.java index 6c8b697..344da7a 100644 --- a/src/main/java/fr/eni/enchere/security/WebSecurityConfig.java +++ b/src/main/java/fr/eni/enchere/security/WebSecurityConfig.java @@ -22,10 +22,15 @@ public class WebSecurityConfig{ .requestMatchers("/profil/**", "/article/new/**", "/article/update", "/article/delete").authenticated() .requestMatchers("/admin").hasRole("ADMIN") .anyRequest().authenticated()) - .formLogin((form) -> form.loginPage("/login").defaultSuccessUrl("/", true)) - .logout((logout) -> logout.clearAuthentication(true).invalidateHttpSession(true) - .deleteCookies("JSESSIONID").logoutSuccessUrl("/logout") - .logoutRequestMatcher(new AntPathRequestMatcher("/logout")).permitAll()); + .formLogin((form) -> form + .loginPage("/login") + .defaultSuccessUrl("/", true)) + .logout((logout) -> logout + .logoutUrl("/logout") + .logoutSuccessUrl("/accueil") // Redirection après déconnexion + .invalidateHttpSession(true) + .clearAuthentication(true) + .deleteCookies("JSESSIONID")); return http.build(); } diff --git a/src/main/resources/i18n/messages_fr.properties b/src/main/resources/i18n/messages_fr.properties index d57e581..9f3a9ce 100644 --- a/src/main/resources/i18n/messages_fr.properties +++ b/src/main/resources/i18n/messages_fr.properties @@ -1,3 +1,44 @@ accueil.search.title = Rechercher un article par nom... accueil.search.cat = Toutes les cat\u00e9gories -accueil.search.button = Recherche \ No newline at end of file +accueil.search.button = Recherche + +profil.title = Mon profil +profil.button = Modifier +profil.pseudo = Pseudo: +profil.surname = Pr\u00e9nom: +profil.name = Nom: +profil.email = Email: +profil.phone = T\u00e9l\u00e9phone: +profil.street = Rue: +profil.postal = Code postal: +profil.city = Ville: +profil.credit = Cr\u00e9dits: + +edit.profil.currentpassword = Mot de passe actuel: +edit.profil.newpassword = Nouveau mot de passe: +edit.profil.confirmnewpassword = Confirmation du nouveau mot de passe: +edit.profil.title = Modifier mon profil +edit.profil.button.edit = Enregistrer les modifications +edit.profil.button.del = Supprimer mon compte + +login.title = Pour se Connecter : +login.id = Identifiant: +login.password = Mot de passe: +login.save = Se souvenir de moi +login.forgotpassword = Mot de passe oubli\u00e9 +login.connection = Connexion +login.makecompte = Cr\u00e9er un compte + +register.title = Mon profil +register.button = Modifier +register.pseudo = Pseudo: +register.surname = Pr\u00e9nom: +register.name = Nom: +register.email = Email: +register.phone = T\u00e9l\u00e9phone: +register.street = Rue: +register.postal = Code postal: +register.city = Ville: +register.credit = Cr\u00e9dits: +register.make = cr\u00e9er +register.cancel = annuler \ No newline at end of file diff --git a/src/main/resources/templates/editProfil.html b/src/main/resources/templates/editProfil.html index d04a20b..e5f0d89 100644 --- a/src/main/resources/templates/editProfil.html +++ b/src/main/resources/templates/editProfil.html @@ -1,158 +1,123 @@ - + -
-

Mon profil

-
- - -
- -
- +
+

+ +
+
+ +
+ + +
+
    +
  • +
+
+
+ +
+ + +
+
    +
  • +
+
+
+ +
+ + +
+
    +
  • +
+
+
+ +
+ + +
+
    +
  • +
+
+
+ +
+ + +
+
    +
  • +
+
+
+ +
+ + +
+
    +
  • +
+
+
+ +
+ + +
+
    +
  • +
+
+
+ +
+ + +
+
    +
  • +
+
+
+ +
+ + +
+ +
+ + +
+ +
+ + +
+
+ +
+ +
- -
    -
  • -
-
- -
- -
- -
- -
    -
  • -
-
-
- -
- -
- -
- -
    -
  • -
-
-
- -
- -
- -
- -
    -
  • -
-
-
- -
- -
- -
- -
    -
  • -
-
-
- -
- -
- -
- -
    -
  • -
-
-
- -
- -
- -
- -
    -
  • -
-
-
- -
- -
- -
- -
    -
  • -
-
-
- -
- -
- -
- -
    -
  • -
-
-
- -
- -
- -
- -
    -
  • -
-
-
- -
- -
- -
- -
    -
  • -
-
-
-
Crédits:
- - - -
- + +
- + diff --git a/src/main/resources/templates/modele-page.html b/src/main/resources/templates/modele-page.html index 5d4572f..08daed0 100644 --- a/src/main/resources/templates/modele-page.html +++ b/src/main/resources/templates/modele-page.html @@ -28,7 +28,7 @@ Mon profile