Merge origin/master

Conflicts:
	web/WEB-INF/AuthentificationJSP.jsp
	web/WEB-INF/ProfilJSP.jsp
This commit is contained in:
elliass.chelloug 2021-10-19 09:50:40 +02:00
parent fa6c0561f6
commit 05e4eb1b4c
3 changed files with 50 additions and 29 deletions

View File

@ -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");
String userSaisi = request.getParameter("ztPseudo");
String mdpSaisi = request.getParameter("ztMDP");
String mdpChiffre = MD5.encode(mdpSaisi);
return isAdmin;
String sql=
return ;
}

View File

@ -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) {
public static String encode(String uneChaine){
MessageDigest md = null;
String myHash = 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();
}
}

View File

@ -1,3 +1,26 @@
<div id="contenu">
<h2>Merci de vous identifier pour acceder aux dossiers</h2>
</div>
<%@include file="jspf/enteteJSPF.jspf" %>
<br /><br />
<table style='border: 0px solid white;'>
<tr>
<td style='border :0px;'>
<fieldset><legend>Coordonnées Pompier</legend>
<table>
<tr><th><label>Nom :<input type="text" name="ztNom" size="20" maxlength="30"></label></th></tr>
<tr><th><label>Prénom :<input type="text" name="ztPrenom" size="20" maxlength="30"></label></th></tr>
<tr><th>Adresse :<input type="text" name="ztAdr" size="20" maxlength="30"></th></tr>
<tr><th>Ville :<input type="text" name="ztVille" size="20" maxlength="30"></th></tr>
<tr><th>Code postal :<input type="text" name="ztCp" size="20" maxlength="30"></th></tr>
<tr><th>Téléphone :<input type="text" name="ztTel" size="20" maxlength="30"></th></tr>
<tr><th>Mail :<input type="text" name="ztMail" size="20" maxlength="30"></th></tr>
<tr><th>Statut :<input type="text" name="ztStatut" size="20" maxlength="30"></th></tr>
<tr><th>Grade :<input type="text" name="ztGrade" size="20" maxlength="30"></th></tr>
</table>
</fieldset>
<fieldset><legend>Coordonnées Employeur</legend>
<table>
<tr><th>Nom employeur : <input type="text" name="ztNomEmp" size="20" maxlength="30"></th></tr>
<tr><th>Téléphone employeur : <input type="text" name="ztTelEmp" size="20" maxlength="30"></th></tr>
<tr><th>Adresse employeur : <input type="text" name="ztadrEmp" size="20" maxlength="30"></th></tr>
<tr><th>Mail employeur : <input type="text" name="ztMailEmp" size="20" maxlength="30"></th></tr>
</table>
</fieldset>