Enhance text readability and error handling: Add readability fixes CSS for improved contrast across UI elements. Update text colors in various components for better visibility. Enhance FTP error handling with user-friendly messages and improved path validation in both frontend and backend. Update HTML templates to provide clearer instructions and examples for FTP path input.

This commit is contained in:
Master3395
2025-09-21 22:26:18 +02:00
parent f5d4c46c37
commit 3432432f91
9 changed files with 734 additions and 36 deletions

View File

@@ -111,7 +111,29 @@ class FTPManager:
return HttpResponse(json_data)
except BaseException as msg:
data_ret = {'status': 0, 'creatFTPStatus': 0, 'error_message': str(msg)}
# Enhanced error handling with better user feedback
error_message = str(msg)
# Provide more user-friendly error messages
if "Invalid path" in error_message:
pass # Keep original message as it's already user-friendly
elif "Security violation" in error_message:
pass # Keep original message as it's already user-friendly
elif "Path validation failed" in error_message:
pass # Keep original message as it's already user-friendly
elif "Exceeded maximum amount" in error_message:
pass # Keep original message as it's already user-friendly
elif "symlinked" in error_message.lower():
error_message = "Cannot create FTP account: The specified path is a symbolic link. Please choose a different path."
elif "Permission denied" in error_message:
error_message = "Permission denied: Unable to create or access the specified directory. Please check the path and try again."
elif "No such file or directory" in error_message:
error_message = "Directory not found: The specified path does not exist. Please check the path and try again."
else:
# Generic fallback for other errors
error_message = f"FTP account creation failed: {error_message}"
data_ret = {'status': 0, 'creatFTPStatus': 0, 'error_message': error_message}
json_data = json.dumps(data_ret)
return HttpResponse(json_data)