forked from NikolaDakov/Group_Project_CB_16_NDPL
-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.py
52 lines (41 loc) · 1.73 KB
/
app.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
from flask import Flask, render_template, request, redirect, url_for
app = Flask(__name__)
# Dictionary to store predefined user credentials
user1 ={'Mario12': '12'}
user2 ={'Luigi13': '13'}
# Route for rendering the login form
@app.route('/')
def view_form():
return render_template('loginStaff.html')
# Route to handle login
@app.route('/login', methods=['POST'])
def login():
if request.method == 'POST':
username = request.form['username']
password = request.form['password']
if username in user1 and user1[username] == password:
return redirect('/marioPage') # Redirect to the 'marioPage' route
elif username in user2 and user2[username] == password:
return redirect('/kitchenPage') # Redirect to the 'luigiPage/kitchenPage' route
else:
return redirect('/invalidMessage')
# -----------------------------------------------------------------------------------------------------------------------
# this will be for trasfer data from menuPage to mario and luigi's pages
# -----------------------------------------------------------------------------------------------------------------------
# Route to display the 'marioPage.html'
@app.route('/marioPage')
def mario_page():
return render_template('marioPage.html')
@app.route('/kitchenPage')
def kitchenPage():
return render_template('kitchenPage.html') #route to display LuigiPage or KitchenPage
# Route to display the 'invalidMessage.html'
@app.route('/invalidMessage')
def invalid_message():
return render_template('invalidMessage.html')
# Route to display the menupage!
@app.route('/MenuPage')
def MenuPage():
return render_template('MenuPage.html')
if __name__ == '__main__':
app.run()