diff --git a/__pycache__/repertoire_identifiants_mot_de_passe.cpython-37.pyc b/__pycache__/repertoire_identifiants_mot_de_passe.cpython-37.pyc index e594e48..b380801 100644 Binary files a/__pycache__/repertoire_identifiants_mot_de_passe.cpython-37.pyc and b/__pycache__/repertoire_identifiants_mot_de_passe.cpython-37.pyc differ diff --git a/app.py b/app.py index 20e44ec..e3e3f99 100644 --- a/app.py +++ b/app.py @@ -8,6 +8,7 @@ app = Flask(__name__) # crée l'application Flask @app.route("/") # URL racine : http://localhost:5000/ def index(): return render_template("user_search.html",display = "none") + return render_template("index.html", Identifiant="Alban") @app.route("/cherche") def cherche(): @@ -19,10 +20,10 @@ def form_add_user(): @app.route("/result_add_user", methods=["POST"]) def result_add_user(): - Identifiant = request.form.get("Identifiant", "").strip() - Mot_de_passe = request.form.get("Mot_de_passe", "").strip() - add_user(Identifiant, Mot_de_passe) - # return render_template("result_add_user.html", Identifiant=Identifiant, Mot_de_passe=Mot_de_passe) + new_user = request.form.get("Identifiant", "").strip() + new_pasword = request.form.get("Mot_de_passe", "").strip() + add_user(new_user, new_pasword) + return render_template("index.html", Identifiant="Alban", added_user=new_user) @app.route("/ajout") def ajout(): diff --git a/mots_de_passe_identifiants.txt b/mots_de_passe_identifiants.txt index c08e10b..b07ce51 100644 --- a/mots_de_passe_identifiants.txt +++ b/mots_de_passe_identifiants.txt @@ -1,10 +1,23 @@ -zebi;;prout -zebi;;prout -zebi;;prout -zebi;;prout zebi;;2 -zebi;;prout -zebi;;prout +lbn;;oui +passepartout;;olivier +test;;3 +test;;3 +zebi;;2 +zebi;;2 +zebi;;2 +zebi;;2 +zebi;;2 +zebi;;2 +opop;;popo +pipi;;caca +caca;;pipi +caca;;pipi +caca;;pipi +vent;;oluie +vent;;oluie +okko;;samourai +bleurj;;gh +bleurj;;gh +bleurj;;gh zebi;;2 -a;;a -user;;password diff --git a/repertoire_identifiants_mot_de_passe.py b/repertoire_identifiants_mot_de_passe.py index ec3ee38..68f6d18 100644 --- a/repertoire_identifiants_mot_de_passe.py +++ b/repertoire_identifiants_mot_de_passe.py @@ -1,10 +1,16 @@ _repertoire_identifiants_mot_de_passe= { "Alban": "mot_de_passe", } +def lecture(): + with open('mots_de_passe_identifiants.txt','r') as f: + for ligne in f: + ligne = ligne.replace("\n","") + Identifiant,mot_de_passe=list(ligne.split(";;")) + _repertoire_identifiants_mot_de_passe[Identifiant]=mot_de_passe + return _repertoire_identifiants_mot_de_passe def verif_user(Identifiant: str, Mot_de_passe: str) -> bool: - # - if _repertoire_identifiants_mot_de_passe.get(Identifiant, "Inconnu") == Mot_de_passe: + if lecture().get(Identifiant, "Inconnu") == Mot_de_passe: return True else: return False diff --git a/templates/index.html b/templates/index.html index a2f553b..f37b95d 100644 --- a/templates/index.html +++ b/templates/index.html @@ -3,6 +3,14 @@
+