|
@@ -41,18 +41,20 @@ def index():
|
|
@app.route("/home")
|
|
@app.route("/home")
|
|
@cache.cached(timeout=60) # cache for 120 seconds
|
|
@cache.cached(timeout=60) # cache for 120 seconds
|
|
def home():
|
|
def home():
|
|
- base_url = app.config["BASE_URL"] # Access base_url from the config
|
|
|
|
- all_accounts = get_user_accounts(base_url, session["auth_credentials"])
|
|
|
|
- count = len(all_accounts)
|
|
|
|
- current_month_accounts = filter_accounts_current_month(all_accounts)
|
|
|
|
- expired_accounts = filter_accounts_expired(all_accounts)
|
|
|
|
- return render_template(
|
|
|
|
- "home.html",
|
|
|
|
- username=session["username"],
|
|
|
|
- accounts=count,
|
|
|
|
- current_month_accounts=current_month_accounts,
|
|
|
|
- expired_accounts=expired_accounts,
|
|
|
|
- )
|
|
|
|
|
|
+ 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"])
|
|
|
|
+ count = len(all_accounts)
|
|
|
|
+ current_month_accounts = filter_accounts_current_month(all_accounts)
|
|
|
|
+ expired_accounts = filter_accounts_expired(all_accounts)
|
|
|
|
+ return render_template(
|
|
|
|
+ "home.html",
|
|
|
|
+ username=session["username"],
|
|
|
|
+ accounts=count,
|
|
|
|
+ current_month_accounts=current_month_accounts,
|
|
|
|
+ expired_accounts=expired_accounts,
|
|
|
|
+ )
|
|
|
|
+ return render_template("index.html")
|
|
|
|
|
|
|
|
|
|
@app.route("/login", methods=["POST"])
|
|
@app.route("/login", methods=["POST"])
|