From 94db0015eec8aff6e4841cdce10d73af26e6b39c Mon Sep 17 00:00:00 2001 From: "thomas.millot" Date: Tue, 19 Oct 2021 09:29:19 +0200 Subject: [PATCH] Merge origin/master Conflicts: web/WEB-INF/AuthentificationJSP.jsp --- src/java/com/test/forms/AuthentifForm.java | 19 ++++++------- src/java/com/test/forms/MD5.java | 31 +++++++++++----------- web/WEB-INF/ProfilJSP.jsp | 29 +++++++++++++++++--- 3 files changed, 50 insertions(+), 29 deletions(-) diff --git a/src/java/com/test/forms/AuthentifForm.java b/src/java/com/test/forms/AuthentifForm.java index c36c1e5..fa0ee26 100644 --- a/src/java/com/test/forms/AuthentifForm.java +++ b/src/java/com/test/forms/AuthentifForm.java @@ -25,17 +25,14 @@ public class AuthentifForm { } public boolean controlerAdmin(HttpServletRequest request) { - /* Comparaison entre l'utilisateur admin et un utilisateur créé - avec le pseudo et le mdp saisi */ - User admin = new User("Lovelace", "Ada"); - User userSaisi = new User(request.getParameter("ztPseudo"), - request.getParameter("ztMDP")); - boolean isAdmin = userSaisi.equals(admin); - - // Mise à jour de l'attribut resultat - setResultat(isAdmin ? "Vous êtes administrateur" : "Vous n'êtes pas administrateur"); - - return isAdmin; + + String userSaisi = request.getParameter("ztPseudo"); + String mdpSaisi = request.getParameter("ztMDP"); + String mdpChiffre = MD5.encode(mdpSaisi); + + String sql= + + return ; } diff --git a/src/java/com/test/forms/MD5.java b/src/java/com/test/forms/MD5.java index c8e284e..974479b 100644 --- a/src/java/com/test/forms/MD5.java +++ b/src/java/com/test/forms/MD5.java @@ -5,31 +5,32 @@ */ package com.test.forms; +/** + * + * @author sio + */ + import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; import java.util.logging.Level; import java.util.logging.Logger; -import javax.xml.bind.DatatypeConverter; -/** - * - * @author Dominique_2 - */ -public abstract class MD5 { - - public static String encode(String uneChaine) { - MessageDigest md = null; - String myHash = null; +public abstract class MD5 { + + public static String encode(String uneChaine){ + MessageDigest md = null; try { md = MessageDigest.getInstance("MD5"); } catch (NoSuchAlgorithmException ex) { - Logger.getLogger(AuthentifForm.class.getName()).log(Level.SEVERE, null, ex); + throw new IllegalArgumentException(ex); } md.update(uneChaine.getBytes()); byte[] digest = md.digest(); - myHash = DatatypeConverter.printHexBinary(digest).toLowerCase(); - - return myHash; + //myHash = DatatypeConverter.printHexBinary(digest).toLowerCase(); + StringBuilder sb = new StringBuilder(); + for (byte b : digest) { + sb.append(String.format("%02x", b)); + } + return sb.toString(); } - } diff --git a/web/WEB-INF/ProfilJSP.jsp b/web/WEB-INF/ProfilJSP.jsp index 9d059b0..3a6fe72 100644 --- a/web/WEB-INF/ProfilJSP.jsp +++ b/web/WEB-INF/ProfilJSP.jsp @@ -1,3 +1,26 @@ -
-

Merci de vous identifier pour acceder aux dossiers

-
+<%@include file="jspf/enteteJSPF.jspf" %> +

+ + +
+
Coordonnées Pompier + + + + + + + + + + +
Adresse :
Ville :
Code postal :
Téléphone :
Mail :
Statut :
Grade :
+
+
Coordonnées Employeur + + + + + +
Nom employeur :
Téléphone employeur :
Adresse employeur :
Mail employeur :
+
\ No newline at end of file