Article title 1
+lorem ipsum
+diff --git a/DEV3.2/TP08/02_Authentification/Authentification.class b/DEV3.2/TP08/02_Authentification/Authentification.class index 233968e..a94c555 100644 Binary files a/DEV3.2/TP08/02_Authentification/Authentification.class and b/DEV3.2/TP08/02_Authentification/Authentification.class differ diff --git a/DEV3.2/TP08/02_Authentification/Authentification.java b/DEV3.2/TP08/02_Authentification/Authentification.java index d8b1b03..7bd5462 100644 --- a/DEV3.2/TP08/02_Authentification/Authentification.java +++ b/DEV3.2/TP08/02_Authentification/Authentification.java @@ -16,13 +16,14 @@ public class Authentification { System.out.println("L'utilisateur '" + username + "' existe déjà."); } else { this.dictionnaire.put(username, password); + System.out.println("Utilisateur ajouté."); } } public void authentifier(String username, String password) { if (this.dictionnaire.get(username) == null) { System.out.println("L'utilisateur '" + username + "' n'existe pas."); - } else if (this.dictionnaire.get(username) != password) { + } else if (!this.dictionnaire.get(username).equals(password)) { System.out.println("Le mot de passe est incorrect."); } else { System.out.println("L'utilisateur '" + username + "' est authentifié."); @@ -43,28 +44,37 @@ public class Authentification { BufferedReader console = new BufferedReader(new InputStreamReader(System.in)); - try { - String input = ""; + String input = ""; + + while (!input.equals("quit")) { + + System.out.print("> "); + + try { - while (!input.equals("quit")) { String[] ligne = console.readLine().split(" "); input = ligne[0]; - System.out.print("> "); + + if (input.equals("add")) { auth.ajouter(ligne[1], ligne[2]); } else if (input.equals("auth")) { auth.authentifier(ligne[1], ligne[2]); } else if (input.equals("del")) { auth.supprimer(ligne[1]); + } else if (input.equals("quit")) { + } else { System.out.println("Commande non reconnue."); } - } - } catch (IOException e) { - System.err.println("Erreur de la console"); - } + } catch (IOException e) { + System.err.println("Erreur de la console"); + } catch (ArrayIndexOutOfBoundsException e1) { + System.err.println("Erreur d'arguments"); + } + } } } \ No newline at end of file diff --git a/reponses_tp3.txt b/reponses_tp3.txt new file mode 100644 index 0000000..e6edd89 --- /dev/null +++ b/reponses_tp3.txt @@ -0,0 +1,347 @@ +----- TP03 ----- + +1. + + + +
+ + +lorem ipsum
+lorem ipsum
+lorem ipsum
+lorem ipsum
+lorem ipsum
+lorem ipsum
+lorem ipsum
+lorem ipsum
+