Skip to content
Merged
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
6 changes: 4 additions & 2 deletions app_setup.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from flask import Flask
import config
from recaptcha_helper import Recaptcha

from datetime import timedelta

app = Flask(__name__)

Expand All @@ -10,7 +10,9 @@

# Set secret key for Flask App.
app.config['SECRET_KEY'] = config.SECRET_KEY

app.config['PERMANENT_SESSION_LIFETIME'] = timedelta(days=30)
app.config['SESSION_COOKIE_SECURE'] = isProd
app.config['SESSION_COOKIE_SAMESITE'] = 'Lax'
if isProd:
# Keys for Google reCAPTCHA.
app.config['RECAPTCHA_SITE_KEY'] = config.RECAPTCHA_SITE_KEY
Expand Down
4 changes: 4 additions & 0 deletions taskapp.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,8 @@ def get_related_completed_item_ids_for_task(user, tier: str, task_id: str) -> li
# Base route for the website, renders hero.html
@app.route('/')
def index():
if session.get('logged_in'):
return redirect(url_for('dashboard'))
return render_template('hero.html')

# Register route, renders registerV2.html on GET request.
Expand Down Expand Up @@ -211,6 +213,8 @@ def register_user():
# On POST request, verifies the users input and logs the user in.
@app.route('/login/', methods= ['GET', 'POST'])
def login():
if request.method == 'GET' and session.get('logged_in'):
return redirect(url_for('dashboard'))
try:
error = None
coll = db['users']
Expand Down
Loading