|
@@ -14,16 +14,20 @@ app.config.from_object(DevelopmentConfig) # Use DevelopmentConfig or Production
|
|
cache = Cache(app, config={'CACHE_TYPE': 'SimpleCache'})
|
|
cache = Cache(app, config={'CACHE_TYPE': 'SimpleCache'})
|
|
|
|
|
|
@app.route('/')
|
|
@app.route('/')
|
|
-@cache.cached(timeout=60) # cache for 120 seconds
|
|
|
|
-def home():
|
|
|
|
|
|
+def index():
|
|
# If the user is logged in, redirect to a protected page like /accounts
|
|
# If the user is logged in, redirect to a protected page like /accounts
|
|
if session.get('logged_in'):
|
|
if session.get('logged_in'):
|
|
- base_url = app.config['BASE_URL'] # Access base_url from the config
|
|
|
|
- all_accounts = get_user_accounts(base_url, session['auth_credentials'])
|
|
|
|
- current_month_accounts = filter_accounts_current_month(all_accounts)
|
|
|
|
- return render_template('home.html', username=session['username'], accounts=get_user_accounts(base_url, session['auth_credentials']), current_month_accounts=current_month_accounts)
|
|
|
|
|
|
+ return redirect(url_for('home'))
|
|
return render_template('index.html')
|
|
return render_template('index.html')
|
|
|
|
|
|
|
|
+@app.route('/home')
|
|
|
|
+@cache.cached(timeout=60) # cache for 120 seconds
|
|
|
|
+def home():
|
|
|
|
+ base_url = app.config['BASE_URL'] # Access base_url from the config
|
|
|
|
+ all_accounts = get_user_accounts(base_url, session['auth_credentials'])
|
|
|
|
+ current_month_accounts = filter_accounts_current_month(all_accounts)
|
|
|
|
+ return render_template('home.html', username=session['username'], accounts=get_user_accounts(base_url, session['auth_credentials']), current_month_accounts=current_month_accounts)
|
|
|
|
+
|
|
@app.route('/login', methods=['POST'])
|
|
@app.route('/login', methods=['POST'])
|
|
def login():
|
|
def login():
|
|
username = request.form['username']
|
|
username = request.form['username']
|