Add localStorage username persistence for auto-login

This commit is contained in:
2025-12-13 15:02:30 +11:00
parent 9465409b2f
commit a7f3bf9b9e
2 changed files with 29 additions and 1 deletions

View File

@@ -250,6 +250,20 @@
multiplayerClient.registerPlayer(username);
}
// Change username
function changeUsername() {
// Clear saved username from localStorage
localStorage.removeItem('connect5_username');
// Show username modal
const modal = document.getElementById('usernameModal');
if (modal) {
modal.classList.add('active');
// Clear the input field
document.getElementById('usernameInput').value = '';
}
}
// Allow Enter key to submit username
document.addEventListener('DOMContentLoaded', () => {
const input = document.getElementById('usernameInput');