This commit is contained in:
clementine.desrucques 2021-10-21 15:13:46 +02:00
parent 3a1a57f348
commit da2b0c201a
3 changed files with 30 additions and 17 deletions

View File

@ -173,20 +173,31 @@ public class PompierMySql {
String mdp = request.getParameter("ztMDP");
String mdpChiffre = MD5.encode(request.getParameter("ztMDP"));
String sql = "SELECT * FROM pompier WHERE login='" + login + "' AND mdp='" + mdpChiffre + "';";
System.out.println("sql:"+sql);
System.out.println("sql:" + sql);
try {
Statement stmt = theConnection.createStatement();
ResultSet resultQ = null;
resultQ = stmt.executeQuery(sql);
resultat = (resultQ.next());
if(resultat){
if (resultat) {
Pompier lePompier = new Pompier(
resultQ.getInt("id"),
resultQ.getInt("id"),
resultQ.getInt("idCAserne"),
resultQ.getString("nom"),
resultQ.getString("prenom"),
resultQ.getInt("statut"),
resultQ.getString("mail"),
resultQ.getString("login"),
resultQ.getString("mdp"),
resultQ.getInt("adrNo"),
resultQ.getString("adrRue"),
resultQ.getString("adrCP"),
resultQ.getString("adrVille"),
resultQ.getInt("grade"),
resultQ.getString("commentaire")
);
HttpSession maSession = request.getSession();
maSession.setAttribute("lePompier", lePompier);
maSession.setAttribute("lePompier", lePompier);
}
} catch (SQLException ex) {

View File

@ -47,19 +47,20 @@ public class NouveauPompForm {
// Creation d'un objet de type Client avec les données transmises
Pompier unPompier = new Pompier(request.getParameter("id"),
Pompier unPompier = new Pompier(
request.getParameter("id"),
request.getParameter("idCaserne"),
request.getParameter("ztNom"),
request.getParameter("ztPrenom"),
request.getParameter("nStatut"),
request.getParameter("eMail"),
request.getParameter("ztLogin"),
request.getParameter("ztMDP"),
request.getParameter("nom"),
request.getParameter("prenom"),
request.getParameter("statut"),
request.getParameter("mail"),
request.getParameter("login"),
request.getParameter("mdp"),
noRue,
request.getParameter("ztAdrRue"),
request.getParameter("ztAdrCP"),
request.getParameter("ztAdrVille"),
request.getParameter("nGrade"),
request.getParameter("adrRue"),
request.getParameter("adrCP"),
request.getParameter("adrVille"),
request.getParameter("grade"),
request.getParameter("commentaire")
);
PompierMySql cm = new PompierMySql();

View File

@ -79,11 +79,12 @@ public class authentifServlet extends HttpServlet {
AuthentifForm leControle = new AuthentifForm();
// Appel de la méthode controlerRole
boolean isAuthentified = leControle.controlerRole(request);
// Création de 2 attributs de requête (isChef et leControle)
// Création de 2 attributs de requête (isAuthentified et leControle)
request.setAttribute("isAuthentified", isAuthentified);
request.setAttribute("controlForm", leControle);
HttpSession maSession = request.getSession();
maSession.setAttribute("isAuthentified", true);
// Affichage de la JSP
if(isAuthentified==true){
getServletContext().getRequestDispatcher("/WEB-INF/PompierJSP.jsp")