Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 0 additions & 13 deletions .idea/CNA340_FinalProject.iml

This file was deleted.

5 changes: 1 addition & 4 deletions .idea/shoppingcart.iml → .idea/CNE310_FinalProject.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/inspectionProfiles/profiles_settings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Large diffs are not rendered by default.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

450 changes: 42 additions & 408 deletions .idea/workspace.xml

Large diffs are not rendered by default.

16 changes: 9 additions & 7 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ def root():
# 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)

Expand Down Expand Up @@ -93,7 +93,7 @@ def displayCategory():
"SELECT products.productId, products.name, products.price, products.image, categories.name FROM products, categories WHERE products.categoryId = categories.categoryId AND categories.categoryId = " + category_id)
data = cur.fetchall()
conn.close()
category_name = data[0][4]
category_name = data[0:]
data = parse(data)
return render_template('displayCategory.html', data=data, loggedIn=logged_in, firstName=first_name,
noOfItems=no_of_items, categoryName=category_name)
Expand Down Expand Up @@ -131,7 +131,7 @@ def change_password():
cur = conn.cursor()
cur.execute("SELECT userId, password FROM users WHERE email = '" + session['email'] + "'")
user_id, password = cur.fetchone()
if (password == old_password):
if (password == old_password):
try:
cur.execute("UPDATE users SET password = ? WHERE userId = ?", (new_password, user_id))
conn.commit()
Expand Down Expand Up @@ -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():
Expand Down Expand Up @@ -357,3 +357,5 @@ def parse(data):

if __name__ == '__main__':
app.run(debug=True)