mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2026-06-13 18:24:20 +00:00
- Implemented dashboard audit logging with InsertAuditLog, GetRecentAuditLogs, GetAuditLogsByIP, and CleanupOldAuditLogs methods. - Created dashboard configuration management with GetDashboardConfig and SetDashboardConfig methods. - Added new tables for dashboard_audit_log and dashboard_config in both MySQL and SQLite migrations. - Updated CMakeLists to include Crow and ASIO for dashboard server functionality. - Enhanced existing database classes to support new dashboard features, including character, play key, and property management. - Added new methods for retrieving and managing play keys, properties, and pet names. - Updated TestSQLDatabase to include stubs for new dashboard-related methods. - Modified shared and dashboard configuration files for new settings.
44 lines
1.7 KiB
JavaScript
44 lines
1.7 KiB
JavaScript
document.addEventListener('DOMContentLoaded', () => {
|
|
const form = document.getElementById('register-form');
|
|
const alertBox = document.getElementById('register-alert');
|
|
|
|
form.addEventListener('submit', async (e) => {
|
|
e.preventDefault();
|
|
alertBox.style.display = 'none';
|
|
const username = document.getElementById('username').value.trim();
|
|
const password = document.getElementById('password').value;
|
|
const play_key = document.getElementById('play_key').value.trim();
|
|
|
|
try {
|
|
const res = await fetch('/api/register', {
|
|
method: 'POST',
|
|
headers: { 'Content-Type': 'application/json' },
|
|
body: JSON.stringify({ username, password, play_key })
|
|
});
|
|
|
|
const data = await res.json();
|
|
if (!res.ok) {
|
|
alertBox.className = 'alert alert-danger';
|
|
alertBox.textContent = data.error || 'Registration failed';
|
|
alertBox.style.display = 'block';
|
|
return;
|
|
}
|
|
|
|
if (data.success) {
|
|
alertBox.className = 'alert alert-success';
|
|
alertBox.textContent = 'Account created successfully. You can now log in.';
|
|
alertBox.style.display = 'block';
|
|
form.reset();
|
|
} else {
|
|
alertBox.className = 'alert alert-danger';
|
|
alertBox.textContent = data.error || 'Registration failed';
|
|
alertBox.style.display = 'block';
|
|
}
|
|
} catch (err) {
|
|
alertBox.className = 'alert alert-danger';
|
|
alertBox.textContent = err.message || 'Registration failed';
|
|
alertBox.style.display = 'block';
|
|
}
|
|
});
|
|
});
|