Fix Auth modal cfg redeclare and auto-open setup
Remove duplicate cfg declaration causing Chrome SyntaxError and auto-open the login setup modal once per browser when Auth0 is not configured. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
12
script.js
12
script.js
@@ -10,6 +10,7 @@
|
|||||||
const THEME_KEY = "links_home_theme_v1";
|
const THEME_KEY = "links_home_theme_v1";
|
||||||
const AUTH_TOAST_ONCE_KEY = "links_home_auth_toast_once_v1";
|
const AUTH_TOAST_ONCE_KEY = "links_home_auth_toast_once_v1";
|
||||||
const AUTH_OVERRIDE_KEY = "links_home_auth_override_v1";
|
const AUTH_OVERRIDE_KEY = "links_home_auth_override_v1";
|
||||||
|
const AUTH_SETUP_SHOWN_KEY = "links_home_auth_setup_shown_v1";
|
||||||
|
|
||||||
const el = {
|
const el = {
|
||||||
subtitle: document.getElementById("subtitle"),
|
subtitle: document.getElementById("subtitle"),
|
||||||
@@ -511,6 +512,11 @@
|
|||||||
auth.mode = "misconfigured";
|
auth.mode = "misconfigured";
|
||||||
updateAuthUi();
|
updateAuthUi();
|
||||||
applyManageLock();
|
applyManageLock();
|
||||||
|
// 브라우저당 1회: 설정 모달 자동 오픈
|
||||||
|
if (!localStorage.getItem(AUTH_SETUP_SHOWN_KEY)) {
|
||||||
|
localStorage.setItem(AUTH_SETUP_SHOWN_KEY, "1");
|
||||||
|
setTimeout(() => openAuthModal(), 80);
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -637,12 +643,6 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function openAuthModal() {
|
function openAuthModal() {
|
||||||
// 운영자만 설정하도록: 기본값은 end-user 설정 비활성
|
|
||||||
const cfg = getAuthConfig();
|
|
||||||
if (!cfg.allowEndUserConfig) {
|
|
||||||
toast("로그인 설정은 관리자만 할 수 있습니다. 관리자에게 문의하세요.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (!el.authModal || !el.authForm) {
|
if (!el.authModal || !el.authForm) {
|
||||||
toast("로그인 설정 UI를 찾지 못했습니다. 새로고침 후 다시 시도하세요.");
|
toast("로그인 설정 UI를 찾지 못했습니다. 새로고침 후 다시 시도하세요.");
|
||||||
return;
|
return;
|
||||||
|
|||||||
Reference in New Issue
Block a user