from flask import Flask, render_template, request, redirect, url_for app = Flask(__name__) # Dummy user database users = { "user1": "password1", "user2": "password2" } @app.route('/') def index(): return render_template('login.html') @app.route('/login', methods=['POST']) def login(): username = request.form['username'] password = request.form['password'] if username in users and users[username] == password: # Successful login return redirect(url_for('welcome', username=username)) else: # Failed login return render_template('login.html', message='Invalid username or password') @app.route('/welcome/ ') def welcome(username): return render_template('welcome.html', username=username) if __name__ == '__main__': app.run(debug=True) body { font-family: Arial, sans-serif; ...
Featured Post
Best Birthday Wishes
- Get link
- X
- Other Apps
happy
birthday!|
hape you have
a great day
today and the
year ahead is
full of many
blessings.
Happy birthday
Today is your big day! i wish
you a happy and fun celebration
with lots of great treats.Enjoy!
May you have all the
joy your heart can
hold,
all the smile a day can
bring,
all the blessing a life
can unfold,
may you get the
world's best in
everything.
May your smile be
bright just like the
sun shines every day.
Happy birthday!
- Get link
- X
- Other Apps
Popular posts from this blog
from flask import Flask, render_template, request, redirect, url_for app = Flask(__name__) # Dummy user database users = { "user1": "password1", "user2": "password2" } @app.route('/') def index(): return render_template('login.html') @app.route('/login', methods=['POST']) def login(): username = request.form['username'] password = request.form['password'] if username in users and users[username] == password: # Successful login return redirect(url_for('welcome', username=username)) else: # Failed login return render_template('login.html', message='Invalid username or password') @app.route('/welcome/ ') def welcome(username): return render_template('welcome.html', username=username) if __name__ == '__main__': app.run(debug=True) body { font-family: Arial, sans-serif; ...
Comments
Post a Comment
If you have any doubts, Please let me know.