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;
background-color: #f2f2f2;
}
.login-container {
max-width: 400px;
margin: 100px auto;
padding: 20px;
background-color: #fff;
border-radius: 5px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}
h2 {
margin-bottom: 20px;
text-align: center;
}
input[type="text"],
input[type="password"] {
width: 100%;
padding: 10px;
margin-bottom: 10px;
border: 1px solid #ccc;
border-radius: 5px;
}
input[type="submit"] {
width: 100%;
padding: 10px;
background-color: #4caf50;
color: #fff;
border: none;
border-radius: 5px;
cursor: pointer;
}
input[type="submit"]:hover {
background-color: #45a049;
}
.error {
color: red;
margin-top: 10px;
text-align: center;
}
Best Birthday Wishes
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!
Comments
Post a Comment
If you have any doubts, Please let me know.