mirror of
https://github.com/DeNNiiInc/Connect-5.git
synced 2026-10-12 19:01:28 +11:00
Add localStorage username persistence for auto-login
This commit is contained in:
1 parent
9465409b2f
commit
a7f3bf9b9e
2 files changed
+29
-1
No files matched your search
+14
@@ -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