mirror of
https://github.com/xtekky/gpt4free.git
synced 2025-12-06 02:30:41 -08:00
Fix user retrieval logic in API key validation to ensure user is set correctly
This commit is contained in:
parent
2dfa807cfb
commit
d6e0cfaae6
1 changed files with 1 additions and 1 deletions
|
|
@ -254,9 +254,9 @@ class Api:
|
||||||
try:
|
try:
|
||||||
data = json.loads(decrypt_data(session_key, user_g4f_api_key))
|
data = json.loads(decrypt_data(session_key, user_g4f_api_key))
|
||||||
expires = int(decrypt_data(private_key, data["data"])) + 86400
|
expires = int(decrypt_data(private_key, data["data"])) + 86400
|
||||||
|
user = data.get("user", user)
|
||||||
if not data.get("user"):
|
if not data.get("user"):
|
||||||
raise ValueError("User not found")
|
raise ValueError("User not found")
|
||||||
user = data.get("user")
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
debug.log(f"Invalid G4F API key '{user_g4f_api_key[:6]}...' for user: '{user}'")
|
debug.log(f"Invalid G4F API key '{user_g4f_api_key[:6]}...' for user: '{user}'")
|
||||||
debug.error(e)
|
debug.error(e)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue