diff --git a/priceybot2/auth.py b/priceybot2/auth.py index 32ce9f0..bb36868 100644 --- a/priceybot2/auth.py +++ b/priceybot2/auth.py @@ -30,35 +30,35 @@ def login_post(): return redirect(url_for('main.profile')) -@auth.route('/signup') -def signup(): - return render_template('signup.html') +# @auth.route('/signup') +# def signup(): +# return render_template('signup.html') -@auth.route('/signup', methods=['POST']) -def signup_post(): - email = request.form.get('email') - name = request.form.get('name') - password = request.form.get('password') - google_id = request.form.get('google_id') +# @auth.route('/signup', methods=['POST']) +# def signup_post(): +# email = request.form.get('email') +# name = request.form.get('name') +# password = request.form.get('password') +# google_id = request.form.get('google_id') - user = User.query.filter_by(email=email).first() +# user = User.query.filter_by(email=email).first() - if user: - flash('Email already exists for user') - return redirect(url_for('auth.signup')) +# if user: +# flash('Email already exists for user') +# return redirect(url_for('auth.signup')) - user = User.query.filter_by(google_id=google_id).first() +# user = User.query.filter_by(google_id=google_id).first() - if user: - flash('Google ID already in use') - return redirect(url_for('auth.signup')) +# if user: +# flash('Google ID already in use') +# return redirect(url_for('auth.signup')) - new_user = User(email=email, name=name, password=generate_password_hash(password, method='sha256'), google_id=google_id) +# new_user = User(email=email, name=name, password=generate_password_hash(password, method='sha256'), google_id=google_id) - db.session.add(new_user) - db.session.commit() - # Code to validate and add the user to the database - return redirect(url_for('auth.login')) +# db.session.add(new_user) +# db.session.commit() +# # Code to validate and add the user to the database +# return redirect(url_for('auth.login')) @auth.route('/logout') @login_required diff --git a/priceybot2/main.py b/priceybot2/main.py index 5e44ed0..7861c71 100644 --- a/priceybot2/main.py +++ b/priceybot2/main.py @@ -1,5 +1,6 @@ from flask import Blueprint, render_template from flask_login import login_required, current_user +from .models import Quote main = Blueprint('main', __name__) @@ -18,3 +19,10 @@ def profile(): google_id=current_user.google_id, is_admin=current_user.administrator ) + + +@main.route('/quotes') +@login_required +def quotes(): + quotes = [q.quote for q in Quote.query.all()] + return render_template("quotes.html", quotes=quotes) \ No newline at end of file diff --git a/priceybot2/templates/base.html b/priceybot2/templates/base.html index 4e5aa44..ee9ecd2 100644 --- a/priceybot2/templates/base.html +++ b/priceybot2/templates/base.html @@ -1,5 +1,5 @@ - +
@@ -24,14 +24,14 @@ Profile + + Quotes + {% endif %} {% if not current_user.is_authenticated %} Login - - Sign Up - {% endif %} {% if current_user.is_authenticated %} @@ -51,6 +51,7 @@ +