Use single auth mode toggle button
This commit is contained in:
@@ -39,7 +39,6 @@
|
||||
<input id="registerEmail" type="email" maxlength="320" autocomplete="email" />
|
||||
</div>
|
||||
<p id="authPolicyHintRegister" class="auth-hint"></p>
|
||||
<button id="showLoginButton" type="button">Login</button>
|
||||
</section>
|
||||
<section id="authSessionView" class="auth-panel hidden">
|
||||
<h2>Logged In</h2>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// Maintainer-controlled web client version.
|
||||
// Format: YYYY.MM.DD Rn (example: 2026.02.20 R2)
|
||||
window.CHGRID_WEB_VERSION = "2026.02.25 R251";
|
||||
window.CHGRID_WEB_VERSION = "2026.02.25 R252";
|
||||
// Optional display timezone for timestamps. Falls back to America/Detroit if unset/invalid.
|
||||
window.CHGRID_TIME_ZONE = "America/Detroit";
|
||||
|
||||
@@ -103,7 +103,6 @@ type Dom = {
|
||||
authSessionView: HTMLElement;
|
||||
authSessionText: HTMLParagraphElement;
|
||||
showRegisterButton: HTMLButtonElement;
|
||||
showLoginButton: HTMLButtonElement;
|
||||
updatesSection: HTMLElement;
|
||||
updatesToggle: HTMLButtonElement;
|
||||
updatesPanel: HTMLDivElement;
|
||||
@@ -138,7 +137,6 @@ const dom: Dom = {
|
||||
authSessionView: requiredById('authSessionView'),
|
||||
authSessionText: requiredById('authSessionText'),
|
||||
showRegisterButton: requiredById('showRegisterButton'),
|
||||
showLoginButton: requiredById('showLoginButton'),
|
||||
updatesSection: requiredById('updatesSection'),
|
||||
updatesToggle: requiredById('updatesToggle'),
|
||||
updatesPanel: requiredById('updatesPanel'),
|
||||
@@ -598,13 +596,12 @@ function updateConnectAvailability(): void {
|
||||
const label = sanitizeAuthUsername(authUsername) || 'current account';
|
||||
dom.authSessionText.textContent = `Logged in as ${label}.`;
|
||||
dom.showRegisterButton.classList.add('hidden');
|
||||
dom.showLoginButton.classList.add('hidden');
|
||||
dom.loginView.classList.add('hidden');
|
||||
dom.registerView.classList.add('hidden');
|
||||
dom.authSessionView.classList.remove('hidden');
|
||||
} else {
|
||||
dom.showRegisterButton.classList.remove('hidden');
|
||||
dom.showLoginButton.classList.remove('hidden');
|
||||
dom.showRegisterButton.textContent = authMode === 'login' ? 'Register' : 'Login';
|
||||
dom.loginView.classList.toggle('hidden', authMode !== 'login');
|
||||
dom.registerView.classList.toggle('hidden', authMode !== 'register');
|
||||
dom.authSessionView.classList.add('hidden');
|
||||
@@ -2634,12 +2631,13 @@ function setupUiHandlers(): void {
|
||||
setOutputDevice: (id) => peerManager.setOutputDevice(id),
|
||||
});
|
||||
dom.showRegisterButton.addEventListener('click', () => {
|
||||
if (authMode === 'login') {
|
||||
setAuthMode('register');
|
||||
dom.registerUsername.focus();
|
||||
});
|
||||
dom.showLoginButton.addEventListener('click', () => {
|
||||
} else {
|
||||
setAuthMode('login');
|
||||
dom.authUsername.focus();
|
||||
}
|
||||
});
|
||||
dom.logoutButton.addEventListener('click', () => {
|
||||
logOutAccount();
|
||||
|
||||
Reference in New Issue
Block a user