Files
DarkflameServer/dDashboardServer/templates/reset_password.jinja2
Aaron Kimbrell e213a7aeff feat: web dashboard and playground work
The NexusDashboard-parity dashboard (dDashboardServer) and everything built on it on the experimental branch:
accounts, characters, properties and moderation tools, permissions shared with in-game slash commands, economy
reports, World 3D and property 3D views with client scenery, scheduled events (features, vanity changes, live
events, announcements, restarts), vanity files and events, the CDClient browser, the message inspector with saved
captures, chat filter tools, community challenges, live ops, the AI moderator helper, and the server-side changes
they need.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 22:30:43 -05:00

57 lines
2.5 KiB
Django/Jinja

{% extends "base.jinja2" %}
{% block title %}Reset Password - DarkflameServer{% endblock %}
{% block content_noauth %}
<div class="d-flex align-items-center justify-content-center min-vh-100">
<div class="card shadow" style="width: 100%; max-width: 420px;">
<div class="card-body p-4">
<h3 class="card-title text-center mb-1">Choose a new password</h3>
<p class="text-body-secondary text-center mb-4">This signs you out of the dashboard everywhere. Your game password changes too.</p>
<div id="alert" class="alert d-none" role="alert"></div>
<form id="resetForm">
<div class="mb-3">
<label for="password" class="form-label">New password</label>
<input type="password" class="form-control" id="password" required minlength="6" maxlength="40" autofocus autocomplete="new-password">
</div>
<div class="mb-3">
<label for="confirm" class="form-label">Confirm new password</label>
<input type="password" class="form-control" id="confirm" required minlength="6" maxlength="40" autocomplete="new-password">
</div>
<button type="submit" class="btn btn-primary w-100" id="submitBtn">Change password</button>
</form>
<p class="text-center small mt-3 mb-0"><a href="/forgot_password">Need a new link?</a></p>
</div>
</div>
</div>
{% endblock %}
{% block scripts %}
<script>
// Keep the token out of the address bar and browser history once we've read it
var token = new URLSearchParams(window.location.search).get('token') || '';
history.replaceState(null, '', '/reset_password');
document.getElementById('resetForm').addEventListener('submit', function (e) {
e.preventDefault();
var alertEl = document.getElementById('alert');
function show(message, ok) { alertEl.textContent = message; alertEl.className = 'alert alert-' + (ok ? 'success' : 'danger'); }
var password = document.getElementById('password').value;
if (password !== document.getElementById('confirm').value) { show('Passwords do not match', false); return; }
if (!token) { show('This page needs the link from your email.', false); return; }
var btn = document.getElementById('submitBtn');
btn.disabled = true;
api.post('/api/auth/reset_password', { token: token, password: password }).then(function (d) {
if (d.success) {
show(d.message, true);
setTimeout(function () { window.location.href = '/login'; }, 2000);
} else {
show(d.error || 'Reset failed', false);
btn.disabled = false;
}
}).catch(function (err) { show('Network error: ' + err.message, false); btn.disabled = false; });
});
</script>
{% endblock %}