mirror of
https://github.com/usmannasir/cyberpanel.git
synced 2025-11-07 22:06:05 +01:00
Implement token generation check in CloudManager and update user token handling in saveChangesAPIAccess. Ensure users are prompted to reset their password if a valid API token is not present when enabling API access.
This commit is contained in:
@@ -99,6 +99,13 @@ def saveChangesAPIAccess(request):
|
||||
|
||||
if access == "Enable":
|
||||
userAcct.api = 1
|
||||
# When enabling API access, ensure the user has a proper token
|
||||
# The token should be generated based on username:password format
|
||||
# If no token exists, we'll need the user to reset their password
|
||||
if not userAcct.token or userAcct.token == 'None' or userAcct.token == '':
|
||||
# Token will be generated when user changes their password
|
||||
# For now, set a placeholder that indicates API access is enabled but token needs generation
|
||||
userAcct.token = 'TOKEN_NEEDS_GENERATION'
|
||||
else:
|
||||
userAcct.api = 0
|
||||
|
||||
|
||||
Reference in New Issue
Block a user