이메일 인증 재발송과 관리자 승인 개선
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<link rel="stylesheet" href="./style/output.css?v=4.0.14" />
|
||||
<link rel="stylesheet" href="./style/output.css?v=4.0.15" />
|
||||
<title>이메일 인증 - UNIARE</title>
|
||||
</head>
|
||||
<body class="app-page">
|
||||
@@ -16,18 +16,24 @@
|
||||
</nav>
|
||||
<main class="mx-auto w-full max-w-md px-6 pt-12 pb-16 sm:pt-16 sm:pb-20">
|
||||
<section class="rounded-2xl border border-slate-200 bg-white p-7 text-center shadow-lg shadow-slate-900/5">
|
||||
<h1 class="text-2xl font-black tracking-tight text-slate-900">이메일 인증</h1>
|
||||
<p id="status-msg" class="mt-3 text-sm leading-relaxed text-slate-500">가입한 이메일로 인증 링크를 보냈습니다.</p>
|
||||
<h1 class="text-2xl font-black tracking-tight text-slate-900" data-i18n="verifyEmailTitle">이메일 인증</h1>
|
||||
<p id="status-msg" class="mt-3 text-sm leading-relaxed text-slate-500" data-i18n="verifyEmailSentDesc">가입한 이메일로 인증 링크를 보냈습니다.</p>
|
||||
<form id="resend-form" class="mt-6">
|
||||
<label class="mb-1.5 block text-left text-xs font-bold uppercase tracking-wider text-slate-400" for="email">이메일</label>
|
||||
<label class="mb-1.5 block text-left text-xs font-bold uppercase tracking-wider text-slate-400" for="email" data-i18n="emailLabel">이메일</label>
|
||||
<input type="email" id="email" required autocomplete="email" class="box-border block w-full rounded-xl border border-slate-200 bg-white px-4 py-3 text-sm text-slate-900 outline-none transition focus:border-blue-500 focus:ring-2 focus:ring-blue-500/15" />
|
||||
<button type="submit" id="resend-submit" class="mt-4 block w-full cursor-pointer rounded-xl border-0 bg-slate-100 px-4 py-3 text-sm font-bold text-slate-700 transition hover:bg-slate-200 disabled:cursor-wait disabled:opacity-70">인증 메일 다시 보내기</button>
|
||||
<button type="submit" id="resend-submit" class="mt-4 block w-full cursor-pointer rounded-xl border-0 bg-slate-100 px-4 py-3 text-sm font-bold text-slate-700 transition hover:bg-slate-200 disabled:cursor-wait disabled:opacity-70" data-i18n="resendVerificationButton">인증 메일 다시 보내기</button>
|
||||
<p class="mt-3 text-left text-xs leading-relaxed text-slate-500" data-i18n="emailMonthlyLimitNotice">인증·비밀번호 재설정 메일은 최초 발송을 포함해 계정당 월 3회까지 발송됩니다.</p>
|
||||
<p class="mt-2 text-left text-xs leading-relaxed text-slate-500">
|
||||
<span data-i18n="emailLimitAdminNotice">월 3회를 초과한 경우 관리자에게 직접 메일을 보내면 확인 후 승인해 드립니다.</span>
|
||||
<a href="mailto:zenn@sori.studio" class="font-bold text-blue-600 underline">zenn@sori.studio</a>
|
||||
</p>
|
||||
</form>
|
||||
<a href="/login.html" class="mt-5 inline-block text-sm font-bold text-blue-600 hover:underline">로그인으로 이동</a>
|
||||
<a id="login-link" href="/login.html" class="mt-5 inline-block text-sm font-bold text-blue-600 hover:underline" data-i18n="goToLogin">로그인으로 이동</a>
|
||||
</section>
|
||||
</main>
|
||||
<script src="/script/api.js?v=4.0.14"></script>
|
||||
<script src="/script/auth-form.js?v=4.0.14"></script>
|
||||
<script src="/script/page-i18n.js"></script>
|
||||
<script src="/script/api.js?v=4.0.15"></script>
|
||||
<script src="/script/auth-form.js?v=4.0.15"></script>
|
||||
<script>
|
||||
const params = new URLSearchParams(location.search);
|
||||
const token = params.get('token');
|
||||
@@ -36,6 +42,16 @@
|
||||
const emailEl = document.getElementById('email');
|
||||
emailEl.value = email;
|
||||
|
||||
/**
|
||||
* 현재 언어 번역 문자열
|
||||
* @param {string} key
|
||||
* @param {string} fallback
|
||||
* @returns {string}
|
||||
*/
|
||||
function verifyText(key, fallback) {
|
||||
return window.UaPageI18n?.t(key, fallback) || fallback;
|
||||
}
|
||||
|
||||
/**
|
||||
* 이메일 인증 토큰 처리
|
||||
* @returns {Promise<void>}
|
||||
@@ -43,14 +59,24 @@
|
||||
async function verifyToken() {
|
||||
if (!token) return;
|
||||
document.getElementById('resend-form').classList.add('hidden');
|
||||
statusEl.textContent = '이메일을 인증하는 중입니다...';
|
||||
statusEl.textContent = verifyText('verifyingEmail', '이메일을 인증하는 중입니다...');
|
||||
try {
|
||||
const result = typeof UaDeckApi.verifyEmail === 'function'
|
||||
await (typeof UaDeckApi.verifyEmail === 'function'
|
||||
? await UaDeckApi.verifyEmail(token)
|
||||
: await UaAuthForm.request('/auth/verify-email', { token });
|
||||
statusEl.textContent = result.message;
|
||||
: await UaAuthForm.request('/auth/verify-email', { token }));
|
||||
statusEl.textContent = verifyText(
|
||||
'verificationCompleteLoginNotice',
|
||||
'이메일 인증이 완료되었습니다. 로그인해 주세요.',
|
||||
);
|
||||
document.getElementById('login-link').href = '/login.html?verified=1';
|
||||
} catch (err) {
|
||||
statusEl.textContent = err.message;
|
||||
statusEl.textContent =
|
||||
err.code === 'VERIFICATION_TOKEN_INVALID'
|
||||
? verifyText(
|
||||
'verificationLinkInvalid',
|
||||
'인증 링크가 유효하지 않거나 만료되었습니다.',
|
||||
)
|
||||
: err.message;
|
||||
document.getElementById('resend-form').classList.remove('hidden');
|
||||
}
|
||||
}
|
||||
@@ -59,25 +85,42 @@
|
||||
event.preventDefault();
|
||||
const submitButton = document.getElementById('resend-submit');
|
||||
if (submitButton.disabled) return;
|
||||
UaAuthForm.setLoading(submitButton, true, '전송 중...');
|
||||
UaAuthForm.setLoading(
|
||||
submitButton,
|
||||
true,
|
||||
verifyText('sendingLabel', '전송 중...'),
|
||||
);
|
||||
let sent = false;
|
||||
try {
|
||||
const result = typeof UaDeckApi.resendVerification === 'function'
|
||||
await (typeof UaDeckApi.resendVerification === 'function'
|
||||
? await UaDeckApi.resendVerification(emailEl.value)
|
||||
: await UaAuthForm.request('/auth/resend-verification', { email: emailEl.value });
|
||||
statusEl.textContent = result.message;
|
||||
: await UaAuthForm.request('/auth/resend-verification', { email: emailEl.value }));
|
||||
statusEl.textContent = verifyText(
|
||||
'verificationResent',
|
||||
'인증 메일을 다시 보냈습니다.',
|
||||
);
|
||||
sent = true;
|
||||
} catch (err) {
|
||||
statusEl.textContent = err.message;
|
||||
statusEl.textContent =
|
||||
err.code === 'MONTHLY_EMAIL_LIMIT_EXCEEDED'
|
||||
? verifyText(
|
||||
'emailLimitExceeded',
|
||||
'월간 이메일 발송 한도(3회)를 초과했습니다. 관리자에게 직접 문의해 주세요.',
|
||||
)
|
||||
: err.message;
|
||||
} finally {
|
||||
if (sent) {
|
||||
UaAuthForm.startCooldown(submitButton, 60, '다시 보내기');
|
||||
UaAuthForm.startCooldown(
|
||||
submitButton,
|
||||
60,
|
||||
verifyText('resendVerificationShort', '다시 보내기'),
|
||||
);
|
||||
} else {
|
||||
UaAuthForm.setLoading(submitButton, false);
|
||||
}
|
||||
}
|
||||
});
|
||||
verifyToken();
|
||||
UaPageI18n.applyPageI18n().then(verifyToken);
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user