From 9dc7a3a182f882ebd5f0978787a663ec4507c521 Mon Sep 17 00:00:00 2001 From: Venix-crypto <71543640+Venix-crypto@users.noreply.github.com> Date: Mon, 21 Nov 2022 20:57:00 -0800 Subject: [PATCH 1/2] Update main.py Fixed login and registration fixed categories --- main.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/main.py b/main.py index 67fb91b..c1e5423 100644 --- a/main.py +++ b/main.py @@ -36,13 +36,13 @@ def root(): # Show last product added cur.execute('SELECT productId, name, price, description, image, stock FROM products ORDER BY productId DESC LIMIT 1 ') # Show all items - #cur.execute('SELECT productId, name, price, description, image, stock FROM products LIMIT 1') + cur.execute('SELECT productId, name, price, description, image, stock FROM products LIMIT 1') item_data = cur.fetchall() # Show an error instead of the categories category_data = [(-1,"Error")] # Show all categories - #cur.execute('SELECT categoryId, name FROM categories') - #category_data = cur.fetchall() + cur.execute('SELECT categoryId, name FROM categories') + category_data = cur.fetchall() item_data = parse(item_data) return render_template('home.html', itemData=item_data, loggedIn=logged_in, firstName=first_name, noOfItems=no_of_items, categoryData=category_data) @@ -176,10 +176,10 @@ def update_profile(): @app.route("/loginForm") def login_form(): # Uncomment to enable logging in and registration - #if 'email' in session: + if 'email' in session: return redirect(url_for('root')) - #else: - # return render_template('login.html', error='') + else: + return render_template('login.html', error='') @app.route("/login", methods = ['POST', 'GET']) def login(): From f6b9523fe08584a2d553f2049034d310e50dd2ec Mon Sep 17 00:00:00 2001 From: ukranian357 <116136636+ukranian357@users.noreply.github.com> Date: Tue, 22 Nov 2022 18:22:13 -0800 Subject: [PATCH 2/2] logging in issue solved for customer code on lines 179-182 has been fixed for the customer all runs as it should now. no bugs reported --- main.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/main.py b/main.py index 67fb91b..fc9203a 100644 --- a/main.py +++ b/main.py @@ -176,10 +176,10 @@ def update_profile(): @app.route("/loginForm") def login_form(): # Uncomment to enable logging in and registration - #if 'email' in session: + if 'email' in session: return redirect(url_for('root')) - #else: - # return render_template('login.html', error='') + else: + return render_template('login.html', error='') @app.route("/login", methods = ['POST', 'GET']) def login():