v0.1.0
This commit is contained in:
@@ -121,6 +121,25 @@ export function bindIdentityDialog({ dialog, onIdentity, initialMode = "login" }
|
||||
message.classList.remove("success");
|
||||
message.classList.add("error");
|
||||
message.textContent = error.message;
|
||||
if (/confirm the account/i.test(error.message) && email.value.trim()) {
|
||||
const resend = document.createElement("button");
|
||||
resend.type = "button";
|
||||
resend.className = "text-button resend-confirmation";
|
||||
resend.textContent = "Resend confirmation e-mail";
|
||||
resend.addEventListener("click", async () => {
|
||||
resend.disabled = true;
|
||||
try {
|
||||
const result = await api("/api/auth/resend-confirmation", { method: "POST", body: JSON.stringify({ email: email.value.trim() }) });
|
||||
message.classList.remove("error");
|
||||
message.classList.add("success");
|
||||
message.textContent = result.message;
|
||||
} catch (resendError) {
|
||||
message.textContent = resendError.message;
|
||||
resend.disabled = false;
|
||||
}
|
||||
});
|
||||
message.append(document.createElement("br"), resend);
|
||||
}
|
||||
} finally {
|
||||
submit.disabled = false;
|
||||
}
|
||||
@@ -255,12 +274,14 @@ function bindLegacyIdentityDialog({ dialog, onIdentity }) {
|
||||
}
|
||||
setAuthSession(session);
|
||||
await onIdentity(session.nickname, session);
|
||||
dialog.close();
|
||||
return;
|
||||
}
|
||||
nickname.disabled = false;
|
||||
const result = await api("/api/auth/identity", { method: "POST", body: JSON.stringify({ nickname: name, session_token: getAuthToken() || null }) });
|
||||
setNickname(result.nickname);
|
||||
await onIdentity(result.nickname, null);
|
||||
dialog.close();
|
||||
} catch (error) {
|
||||
message.classList.remove("success");
|
||||
message.classList.add("error");
|
||||
|
||||
Reference in New Issue
Block a user