@@ -1679,7 +1679,7 @@ ${commonRules}`;
16791679 <div class="sdrop-section">个性化设置</div>
16801680 <div class="sdrop-item" id="settingsThemeRow">
16811681 <span>🌓 界面主题</span>
1682- <label class="toggle-switch" onclick="event.stopPropagation() ">
1682+ <label class="toggle-switch" id="themeToggleLabel ">
16831683 <input type="checkbox" id="themeToggle" />
16841684 <span class="toggle-slider"></span>
16851685 </label>
@@ -1695,24 +1695,24 @@ ${commonRules}`;
16951695 <span class="badge-soon">即将推出</span>
16961696 </div>
16971697 <div class="sdrop-divider"></div>
1698- <div class="sdrop-item" id="settingsAuthRow" onclick="toggleSettingsAuth()" >
1698+ <div class="sdrop-item" id="settingsAuthRow">
16991699 <span id="settingsAuthLabel">🔑 账户登录</span>
17001700 <span id="settingsAuthArrow" style="font-size:10px;color:var(--muted)">▾</span>
17011701 </div>
17021702 <div id="settingsAuthPanel" class="sdrop-auth-panel">
17031703 <div id="authError" class="auth-error"></div>
17041704 <input id="authUser" type="text" placeholder="用户名或邮箱" autocomplete="username" />
1705- <input id="authPass" type="password" placeholder="密码" autocomplete="current-password" onkeydown="if(event.key==='Enter')doAuth()" />
1705+ <input id="authPass" type="password" placeholder="密码" autocomplete="current-password" />
17061706 <div style="display:flex;gap:6px;margin-top:4px">
1707- <button class="sdrop-login-btn" onclick="doAuth() ">登录</button>
1708- <button class="sdrop-register-btn" onclick="openRegister() ">前往注册 ↗</button>
1707+ <button class="sdrop-login-btn" id="authLoginBtn ">登录</button>
1708+ <button class="sdrop-register-btn" id="authRegisterBtn ">前往注册 ↗</button>
17091709 </div>
17101710 </div>
17111711 <div id="settingsUserRow" class="sdrop-user-row" style="display:none">
17121712 <div style="display:flex;align-items:center;justify-content:space-between">
17131713 <span style="color:var(--success);font-weight:600">👤 <span id="authUsername"></span>
17141714 <span style="color:var(--muted)" id="authPlan"></span></span>
1715- <button onclick="doLogout() " style="background:none;border:none;color:var(--muted);cursor:pointer;font-size:11px;text-decoration:underline">退出</button>
1715+ <button id="authLogoutBtn " style="background:none;border:none;color:var(--muted);cursor:pointer;font-size:11px;text-decoration:underline">退出</button>
17161716 </div>
17171717 <div id="authCredits" style="font-size:11px;color:var(--muted);margin-top:2px"></div>
17181718 </div>
@@ -1956,6 +1956,19 @@ ${commonRules}`;
19561956 vscode.postMessage({ command: 'logout' });
19571957 }
19581958
1959+ // ── 认证相关事件绑定(CSP 禁止内联 onclick,必须用 addEventListener) ──
1960+ const settingsAuthRow = document.getElementById('settingsAuthRow');
1961+ if (settingsAuthRow) settingsAuthRow.addEventListener('click', toggleSettingsAuth);
1962+ if (authPass) authPass.addEventListener('keydown', (e) => { if (e.key === 'Enter') doAuth(); });
1963+ const authLoginBtn = document.getElementById('authLoginBtn');
1964+ if (authLoginBtn) authLoginBtn.addEventListener('click', doAuth);
1965+ const authRegisterBtn = document.getElementById('authRegisterBtn');
1966+ if (authRegisterBtn) authRegisterBtn.addEventListener('click', openRegister);
1967+ const authLogoutBtn = document.getElementById('authLogoutBtn');
1968+ if (authLogoutBtn) authLogoutBtn.addEventListener('click', doLogout);
1969+ const themeToggleLabel = document.getElementById('themeToggleLabel');
1970+ if (themeToggleLabel) themeToggleLabel.addEventListener('click', (e) => e.stopPropagation());
1971+
19591972 function setAuthState(loggedIn, user) {
19601973 const authPanel = document.getElementById('settingsAuthPanel');
19611974 const userRow = document.getElementById('settingsUserRow');
0 commit comments