Compare commits
3 Commits
ad42907ad9
...
473fecdcc7
Author | SHA1 | Date | |
---|---|---|---|
473fecdcc7 | |||
4deb681b99 | |||
e2559fab30 |
@ -1,5 +1,5 @@
|
||||
[tool.bumpversion]
|
||||
current_version = "1.4.13"
|
||||
current_version = "1.4.14"
|
||||
commit = true
|
||||
tag = true
|
||||
tag_name = "{new_version}"
|
||||
|
24
app.py
24
app.py
@ -189,10 +189,21 @@ def login() -> Union[Response, str]:
|
||||
response.raise_for_status()
|
||||
response_data = response.json()
|
||||
if response_data.get("auth") == "Success":
|
||||
# Ensure case-sensitive username comparison
|
||||
if response_data.get("username") != username:
|
||||
return render_template("index.html", error="Invalid username or password. Please try again.")
|
||||
|
||||
session["logged_in"] = True
|
||||
session["username"] = response_data.get("username", username)
|
||||
session["user_id"] = response_data.get("user_id")
|
||||
session["auth_credentials"] = encoded_credentials
|
||||
|
||||
# Check if the user has at least one account
|
||||
base_url = app.config["BACKEND_URL"]
|
||||
all_accounts = get_user_accounts(base_url, session["auth_credentials"])
|
||||
if not all_accounts:
|
||||
return render_template("index.html", error="No accounts associated with this user.")
|
||||
|
||||
next_url = request.args.get("next")
|
||||
if next_url:
|
||||
return redirect(next_url)
|
||||
@ -255,6 +266,11 @@ def add_account() -> Union[Response, str]:
|
||||
# Clear cache for user accounts route
|
||||
cache_key = f"view/{session['username']}/accounts"
|
||||
cache.delete(cache_key)
|
||||
# Also clear memoized version for good measure
|
||||
cache.delete_memoized(user_accounts, key_prefix=make_cache_key)
|
||||
# Clear home page cache as well since it shows account stats
|
||||
cache_key_home = f"view/{session['username']}/home"
|
||||
cache.delete(cache_key_home)
|
||||
# Run the NPM config update in a background thread
|
||||
thread = threading.Thread(target=_update_npm_config_in_background)
|
||||
thread.start()
|
||||
@ -275,6 +291,11 @@ def delete_account() -> Response:
|
||||
# Clear cache for user accounts route
|
||||
cache_key = f"view/{session['username']}/accounts"
|
||||
cache.delete(cache_key)
|
||||
# Also clear memoized version for good measure
|
||||
cache.delete_memoized(user_accounts, key_prefix=make_cache_key)
|
||||
# Clear home page cache as well since it shows account stats
|
||||
cache_key_home = f"view/{session['username']}/home"
|
||||
cache.delete(cache_key_home)
|
||||
return redirect(url_for("user_accounts"))
|
||||
|
||||
@app.route("/validateAccount", methods=["POST"])
|
||||
@ -295,6 +316,9 @@ def validate_account() -> Tuple[Response, int]:
|
||||
response_data = response.json()
|
||||
if response_data.get("message") == "Account is valid and updated":
|
||||
cache.delete_memoized(user_accounts, key_prefix=make_cache_key)
|
||||
# Also clear regular cache for good measure
|
||||
cache_key = f"view/{session['username']}/accounts"
|
||||
cache.delete(cache_key)
|
||||
# Run the NPM config update in a background thread
|
||||
thread = threading.Thread(target=_update_npm_config_in_background)
|
||||
thread.start()
|
||||
|
Loading…
x
Reference in New Issue
Block a user