From 6d8dd2d3257e43a522f07beee748b5b0a5f36542 Mon Sep 17 00:00:00 2001 From: victorias Date: Wed, 22 Jan 2020 10:28:32 +0200 Subject: [PATCH] add message incorrect password --- app.py | 12 ++++++++++-- templates/incorrectPassword.html | 19 +++++++++++++++++++ 2 files changed, 29 insertions(+), 2 deletions(-) create mode 100644 templates/incorrectPassword.html diff --git a/app.py b/app.py index 7ea766a..252c9f5 100644 --- a/app.py +++ b/app.py @@ -38,7 +38,8 @@ def home(): def contact_us(): return render_template('/contact_us.html') -@app.route('/send_message',methods=['GET', 'POST']) + +@app.route('/send_message', methods=['GET', 'POST']) def send_message(): if request.method == 'POST': userDetails = request.form @@ -52,7 +53,6 @@ def send_message(): return render_template('/send_message.html') - def authenticate_user(username, password): if check_username(username): if check_password(username, password): @@ -119,3 +119,11 @@ def check_username(username): else: # the user exists return True + + +def incorrect_password(): + if request.method == 'POST': + return render_template('Home.html') + if password is not correct: + flash("Oh no! The password you entered is incorrect. Please try again.") + return render_template('/incorrectPassword.html') diff --git a/templates/incorrectPassword.html b/templates/incorrectPassword.html new file mode 100644 index 0000000..033e05e --- /dev/null +++ b/templates/incorrectPassword.html @@ -0,0 +1,19 @@ + +
+ +
+ +
+ {% with messages = get_flashed_messages() %} + {% if messages %} + {% for message in messages %} + + {% end for %} + {% end if %} + {% end with %} + {% block body %}{% end block %} +
+ + +