Skip to content

Commit 0374ee3

Browse files
Merge pull request #53 from GitTimeraider/develop
Multiple triggers removed that were made for troubleshooting from the backend
2 parents 9778253 + b5e8ccf commit 0374ee3

File tree

5 files changed

+31
-17
lines changed

5 files changed

+31
-17
lines changed

app/directadmin_api.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -280,8 +280,10 @@ def validate_domain_access(self):
280280
return False, "Unable to verify domain access"
281281

282282
except Exception as e:
283+
import traceback
283284
print(f"Error validating domain access: {e}")
284-
return False, f"Error validating domain: {str(e)}"
285+
traceback.print_exc()
286+
return False, "An internal error occurred while validating domain access."
285287

286288
def get_email_accounts(self):
287289
"""Get all email accounts for the domain"""

app/main.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,8 +118,10 @@ def get_migration_status():
118118
})
119119

120120
except Exception as e:
121+
print(f"Error in /api/migration-status: {str(e)}")
122+
traceback.print_exc()
121123
return jsonify({
122-
'error': f'Migration status check failed: {str(e)}',
124+
'error': 'An internal error occurred while checking migration status.',
123125
'success': False
124126
}), 500
125127

app/settings.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -139,21 +139,21 @@ def test_connection():
139139
return jsonify(result)
140140

141141
except Exception as e:
142-
error_msg = str(e)
143-
print(f"Test connection error: {error_msg}")
142+
print(f"Test connection error: {str(e)}")
144143
print(traceback.format_exc())
145144

146-
# Provide more specific error messages
147-
if 'timeout' in error_msg.lower():
148-
error_msg = 'Connection timed out. Please check your DirectAdmin server URL and network connection.'
149-
elif 'connection' in error_msg.lower():
150-
error_msg = 'Unable to connect to DirectAdmin server. Please verify the server URL is correct.'
151-
elif 'ssl' in error_msg.lower() or 'certificate' in error_msg.lower():
152-
error_msg = 'SSL certificate error. Try using HTTP instead of HTTPS, or check your certificate configuration.'
145+
# Provide more specific error messages to the user, do not return exception messages
146+
user_error_msg = None
147+
error_str = str(e).lower()
148+
if 'timeout' in error_str:
149+
user_error_msg = 'Connection timed out. Please check your DirectAdmin server URL and network connection.'
150+
elif 'connection' in error_str:
151+
user_error_msg = 'Unable to connect to DirectAdmin server. Please verify the server URL is correct.'
152+
elif 'ssl' in error_str or 'certificate' in error_str:
153+
user_error_msg = 'SSL certificate error. Try using HTTP instead of HTTPS, or check your certificate configuration.'
153154
else:
154-
error_msg = f'Connection test failed: {error_msg}'
155-
156-
return jsonify({'error': error_msg, 'success': False}), 200
155+
user_error_msg = 'Connection test failed. Please contact support or try again later.'
156+
return jsonify({'error': user_error_msg, 'success': False}), 200
157157

158158
@settings_bp.route('/api/domains', methods=['GET'])
159159
@login_required

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@ pyotp==2.9.0
77
qrcode==8.2
88
pillow==11.3.0
99
requests==2.32.5
10-
cryptography==46.0.1
10+
cryptography==46.0.2

static/dashboard.js

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,16 @@ let emailAccounts = [];
44
let availableDomains = [];
55
let selectedDomain = null;
66

7+
// Escape a string for HTML insertion (prevents XSS)
8+
function escapeHTML(str) {
9+
return String(str)
10+
.replace(/&/g, "&")
11+
.replace(/</g, "&lt;")
12+
.replace(/>/g, "&gt;")
13+
.replace(/"/g, "&quot;")
14+
.replace(/'/g, "&#39;");
15+
}
16+
717
// Helper function to validate destinations (including special ones)
818
function isValidDestination(destination) {
919
// Allow special destinations
@@ -228,9 +238,9 @@ async function loadForwarders() {
228238
console.error('Error loading forwarders:', error);
229239

230240
if (error.response && error.response.status === 403) {
231-
tbody.innerHTML = '<tr><td colspan="3" class="error-message">Domain access denied: ' + selectedDomain + ' may not be configured in your DirectAdmin account.</td></tr>';
241+
tbody.innerHTML = '<tr><td colspan="3" class="error-message">Domain access denied: ' + escapeHTML(selectedDomain) + ' may not be configured in your DirectAdmin account.</td></tr>';
232242
} else {
233-
tbody.innerHTML = '<tr><td colspan="3" class="error-message">Failed to load forwarders for ' + selectedDomain + '. Please check your DirectAdmin settings.</td></tr>';
243+
tbody.innerHTML = '<tr><td colspan="3" class="error-message">Failed to load forwarders for ' + escapeHTML(selectedDomain) + '. Please check your DirectAdmin settings.</td></tr>';
234244
}
235245
}
236246
}

0 commit comments

Comments
 (0)