diff --git a/__pycache__/app.cpython-311.pyc b/__pycache__/app.cpython-311.pyc index 804a228..a555d52 100644 Binary files a/__pycache__/app.cpython-311.pyc and b/__pycache__/app.cpython-311.pyc differ diff --git a/app.py b/app.py index 4fdadcc..d90e3d3 100644 --- a/app.py +++ b/app.py @@ -1,32 +1,28 @@ -from flask import Flask, jsonify, request, render_template +from flask import Flask, jsonify, request, render_template, session, redirect, url_for from flask_cors import CORS -import requests from flask_sqlalchemy import SQLAlchemy - app = Flask(__name__) CORS(app) -app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///mydatabase.db' -db = SQLAlchemy(app) + +# Set a secret key for session management +app.secret_key = 'your_secret_key' # Change this to a strong, random secret key + + +def is_user_authenticated(): + print(str(session)) + return 'user_id' in session + @app.route('/') -def index(): +def main_index(): + return render_template('index.html') + +@app.route('/home') +def login_page(): return render_template('landing_page.html') @app.route('/about') def about(): return render_template('aboutus.html') -@app.route('/yelp-test') -def yelp_default_test(): - url = "https://zotmeal-backend.vercel.app/api" - - querystring = {"location": "anteatery"} - - response = requests.request( - "GET", url, params=querystring) - - return (jsonify(response.json())) -@app.route('/home') -def home(): - return render_template('home.html') @app.route('/view') def view(): return render_template('view.html') @@ -38,8 +34,5 @@ def edit(): return render_template('edit.html') - if __name__ == '__main__': - db.create_all() app.run(debug=True) - diff --git a/static/firebase.js b/static/firebase.js index 6a4a0f4..ec166d0 100644 --- a/static/firebase.js +++ b/static/firebase.js @@ -51,7 +51,7 @@ const register = document.getElementById("register-btn"); email: email, password: password }); - window.location.href = "http://127.0.0.1:5000/home"; + window.location.href = "/home"; }) .catch((error) => { const errorCode = error.code; @@ -74,7 +74,7 @@ const register = document.getElementById("register-btn"); password: password }); console.log('hello') - window.location.href = "http://127.0.0.1:5000/home"; + window.location.href = "/home"; }) .catch((error) => { const errorCode = error.code; @@ -95,7 +95,7 @@ document.addEventListener("DOMContentLoaded", function() { password: password }); - window.location.href = "http://127.0.0.1:5000/home"; + window.location.href = "/home"; }).catch((error) => { const errorCode = error.code; const errorMessage = error.message; diff --git a/static/home.js b/static/home.js index 18b5240..751ba50 100644 --- a/static/home.js +++ b/static/home.js @@ -10,17 +10,17 @@ document.addEventListener("DOMContentLoaded", function() { */ const view = document.getElementById("view"); view.addEventListener("click", function() { - window.location.href = "http://127.0.0.1:5000/view"; + window.location.href = "/view"; }); const send = document.getElementById("send"); send.addEventListener("click", function() { console.log('asdfasdf2') - window.location.href = "http://127.0.0.1:5000/send"; + window.location.href = "/send"; }); const edit = document.getElementById("edit"); edit.addEventListener("click", function() { console.log('asdfasdf3') - window.location.href = "http://127.0.0.1:5000/edit"; + window.location.href = "/edit"; }); }); \ No newline at end of file diff --git a/templates/landing_page.html b/templates/landing_page.html index 6ae70e0..752b390 100644 --- a/templates/landing_page.html +++ b/templates/landing_page.html @@ -6,6 +6,7 @@ + @@ -68,9 +69,9 @@

Sign in

- - - + + +