mirror of
https://github.com/DeNNiiInc/Connect-5.git
synced 2026-04-17 20:36:00 +00:00
Add localStorage username persistence for auto-login
This commit is contained in:
14
index.html
14
index.html
@@ -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');
|
||||
|
||||
Reference in New Issue
Block a user