diff --git a/shared/components/rstack-identity.ts b/shared/components/rstack-identity.ts index b15e029..3619c93 100644 --- a/shared/components/rstack-identity.ts +++ b/shared/components/rstack-identity.ts @@ -711,7 +711,7 @@ export class RStackIdentity extends HTMLElement { let openSection: string | null = null; // Account completion status - let acctStatus: { email: boolean; multiDevice: boolean; socialRecovery: boolean; guardianCount: number; credentialCount: number } | null = null; + let acctStatus: { email: boolean; emailAddress?: string | null; multiDevice: boolean; socialRecovery: boolean; guardianCount: number; credentialCount: number } | null = null; // Lazy-loaded data let guardians: { id: string; name: string; email?: string; status: string }[] = []; @@ -819,10 +819,13 @@ export class RStackIdentity extends HTMLElement { `; } } + const emailDisplay = !isOpen && done && acctStatus?.emailAddress + ? `${acctStatus.emailAddress}` + : ""; return `
- ${statusDot(done)} ✉️ Email + ${statusDot(done)} ✉️ Email${emailDisplay} ${isOpen ? "▾" : "▸"}
${body} @@ -1087,7 +1090,7 @@ export class RStackIdentity extends HTMLElement { body: JSON.stringify({ email: emailAddr, code }), }); if (!res.ok) throw new Error((await res.json().catch(() => ({}))).error || "Verification failed"); - if (acctStatus) acctStatus.email = true; + if (acctStatus) { acctStatus.email = true; acctStatus.emailAddress = emailAddr; } openSection = null; render(); this.dispatchEvent(new CustomEvent("identity-action", { bubbles: true, composed: true, detail: { action: "email-added", email: emailAddr } })); } catch (e: any) { diff --git a/src/encryptid/db.ts b/src/encryptid/db.ts index 9b5f1df..0d8daa5 100644 --- a/src/encryptid/db.ts +++ b/src/encryptid/db.ts @@ -224,7 +224,7 @@ export async function cleanExpiredChallenges(): Promise { // ============================================================================ export async function setUserEmail(userId: string, email: string): Promise { - await sql`UPDATE users SET email = ${email} WHERE id = ${userId}`; + await sql`UPDATE users SET email = ${email}, profile_email = ${email}, updated_at = NOW() WHERE id = ${userId}`; } export async function getUserByEmail(email: string) {