Real-time monitoring dashboard for Proxmox VE, PBS, Docker, Kubernetes, TrueNAS and vSphere. Self-hosted, with alerts for failed backups, full disks, unhealthy containers and offline nodes.
Go aialertsdashboarddockerdocker-monitoringgohomelabinfrastructure-monitoringkubernetesmonitoringmspproxmoxproxmox-backup-serverproxmox-mail-gatewayproxmox-veself-hostedtruenastypescriptvspherewebhooks
fix(cloudcp): tell the truth about magic-link delivery
Richard Courtman8c168ffb2efa
diff --git a/internal/cloudcp/portal/dist/build_manifest.json b/internal/cloudcp/portal/dist/build_manifest.jsonindex d35c7ba724..cb2fe3eea2 100644--- a/internal/cloudcp/portal/dist/build_manifest.json+++ b/internal/cloudcp/portal/dist/build_manifest.json@@ -1,5 +1,5 @@{- "source_hash": "07cc157c9e51171f54b181dc953c685e2687e14af66407867c678e0bcd370540",+ "source_hash": "a41c0f493009a2110dc67108737842f8e0941d20366700fd5f0398e690a71b5b","build_inputs": ["package.json","tsconfig.json",diff --git a/internal/cloudcp/portal/dist/portal_app.js b/internal/cloudcp/portal/dist/portal_app.jsindex 88c380ebb4..f3619f9881 100644--- a/internal/cloudcp/portal/dist/portal_app.js+++ b/internal/cloudcp/portal/dist/portal_app.js@@ -373,7 +373,8 @@return {emailValue: "",request: createMutationState(),- success: false+ success: false,+ successMessage: ""};}function createPortalAccountState() {@@ -710,6 +711,7 @@}// src/auth_controller.ts+ var GENERIC_MAGIC_LINK_MESSAGE = "If that email is registered, you'll receive a magic link shortly.";function asHTMLElement2(target) {return target instanceof HTMLElement ? target : null;}@@ -732,12 +734,14 @@deps.store.updateLoginState(function(nextState) {beginMutationState(nextState.request);nextState.success = false;+ nextState.successMessage = "";});try {- await deps.api.requestMagicLink(email);+ var response = await deps.api.requestMagicLink(email);deps.store.updateLoginState(function(nextState) {succeedMutationState(nextState.request);nextState.success = true;+ nextState.successMessage = String(response && response.message || "").trim() || GENERIC_MAGIC_LINK_MESSAGE;});return;} catch (error) {@@ -745,6 +749,7 @@deps.store.updateLoginState(function(nextState) {succeedMutationState(nextState.request);nextState.success = true;+ nextState.successMessage = GENERIC_MAGIC_LINK_MESSAGE;});return;}@@ -769,6 +774,7 @@event.preventDefault();deps.store.updateLoginState(function(nextState) {nextState.success = false;+ nextState.successMessage = "";resetMutationState(nextState.request);});void sendMagicLink();@@ -1441,7 +1447,7 @@if (context.loginState.request.error) {statusHTML = '<div class="service-status visible error">' + escapeHTML(context.loginState.request.error) + "</div>";} else if (context.loginState.success) {- statusHTML = `<div class="service-status visible success">Magic link sent. Check your inbox and click the link to sign in.<br><br><strong>Don't see it?</strong> <a href="#" data-portal-action="resend-magic-link">Send a new link</a>.</div>`;+ statusHTML = '<div class="service-status visible success">' + escapeHTML(context.loginState.successMessage || "If that email is registered, you'll receive a magic link shortly.") + `<br><br><strong>Don't see it?</strong> <a href="#" data-portal-action="resend-magic-link">Send a new link</a>.</div>`;}return '<section class="intro-card"><h1>Pulse Account</h1><p>Sign in to manage Cloud workspaces, MSP access, and commercial account services from one account surface.</p></section><section class="service-section"><div class="service-panel visible"><h3>Sign in</h3><p>Enter the commercial email address for your Pulse account. I will send a magic link so you can open Pulse Account without managing a password.</p><div class="form-group"><label for="portal-login-email">Email address</label><input id="portal-login-email" type="email" autocomplete="email" placeholder="[email protected]" value="' + escapeAttr(context.loginState.emailValue || "") + '" data-portal-input="login-email"></div><div class="form-actions"><button class="btn-primary" id="portal-login-send" type="button" data-portal-action="send-magic-link">' + (context.loginState.request.pending ? "Sending\u2026" : "Send magic link") + '</button><a class="btn-secondary link-button" href="' + escapeAttr(context.signupPath) + '">Create an account</a></div>' + statusHTML + "</div></section>";}diff --git a/internal/cloudcp/portal/frontend/src/api.ts b/internal/cloudcp/portal/frontend/src/api.tsindex ae2b7311b6..f18bc1cd18 100644--- a/internal/cloudcp/portal/frontend/src/api.ts+++ b/internal/cloudcp/portal/frontend/src/api.ts@@ -20,6 +20,11 @@ export interface PortalBillingResponse {url?: string;}+export interface PortalMagicLinkResponse {+ success?: boolean;+ message?: string;+}+export interface PortalWorkspaceCreateRequest {display_name: string;}@@ -35,7 +40,7 @@ export interface PortalMemberRoleRequest {export interface PortalAPI {fetchBootstrap(): Promise<PortalBootstrapData>;- requestMagicLink(email: string): Promise<void>;+ requestMagicLink(email: string): Promise<PortalMagicLinkResponse>;logout(): Promise<void>;postCommercialJSON<T>(path: string, body: Record<string, unknown>): Promise<T>;createWorkspace(accountID: string, body: PortalWorkspaceCreateRequest): Promise<void>;@@ -125,7 +130,7 @@ export function createPortalAPI(context: PortalAPIContext): PortalAPI {}, 'Failed to refresh account state.');},requestMagicLink: function(email: string) {- return request<void>(bootstrap().magic_link_request_path, {+ return request<PortalMagicLinkResponse>(bootstrap().magic_link_request_path, {method: 'POST',headers: { 'Content-Type': 'application/json' },body: JSON.stringify({ email: email }),diff --git a/internal/cloudcp/portal/frontend/src/app.test.ts b/internal/cloudcp/portal/frontend/src/app.test.tsindex 179d4f4834..58a349007d 100644--- a/internal/cloudcp/portal/frontend/src/app.test.ts+++ b/internal/cloudcp/portal/frontend/src/app.test.ts@@ -186,7 +186,10 @@ describe('portal app', function() {email: '',accounts: [],});- var fetchMock = vi.fn().mockResolvedValue(jsonResponse({}));+ var fetchMock = vi.fn().mockResolvedValue(jsonResponse({+ success: true,+ message: "If that email is registered, you'll receive a magic link shortly.",+ }));vi.stubGlobal('fetch', fetchMock);installPortalApp({@@ -209,7 +212,7 @@ describe('portal app', function() {body: JSON.stringify({ email: '[email protected]' }),}));- expect(document.getElementById('portal-app-root')?.textContent).toContain('Magic link sent. Check your inbox and click the link to sign in.');+ expect(document.getElementById('portal-app-root')?.textContent).toContain("If that email is registered, you'll receive a magic link shortly.");});it('completes the retrieve-license flow through the real authenticated app shell', async function() {diff --git a/internal/cloudcp/portal/frontend/src/auth_controller.test.ts b/internal/cloudcp/portal/frontend/src/auth_controller.test.tsindex 7d5ffec06c..897417e3c8 100644--- a/internal/cloudcp/portal/frontend/src/auth_controller.test.ts+++ b/internal/cloudcp/portal/frontend/src/auth_controller.test.ts@@ -58,6 +58,13 @@ describe('auth controller', function() {vi.fn().mockResolvedValue({ok: true,status: 200,+ headers: new Headers({ 'content-type': 'application/json' }),+ json: async function() {+ return {+ success: true,+ message: "If that email is registered, you'll receive a magic link shortly.",+ };+ },}));@@ -81,6 +88,7 @@ describe('auth controller', function() {expect(controller.getLoginState().request.pending).toBe(false);expect(controller.getLoginState().request.error).toBe('');expect(controller.getLoginState().success).toBe(true);+ expect(controller.getLoginState().successMessage).toBe("If that email is registered, you'll receive a magic link shortly.");expect(fetch).toHaveBeenCalledWith('/magic-link',expect.objectContaining({diff --git a/internal/cloudcp/portal/frontend/src/auth_controller.ts b/internal/cloudcp/portal/frontend/src/auth_controller.tsindex c13d6386f7..51e87d3871 100644--- a/internal/cloudcp/portal/frontend/src/auth_controller.ts+++ b/internal/cloudcp/portal/frontend/src/auth_controller.ts@@ -16,6 +16,8 @@ export interface AuthController {getLoginState: () => PortalLoginState;}+const GENERIC_MAGIC_LINK_MESSAGE = "If that email is registered, you'll receive a magic link shortly.";+function asHTMLElement(target: EventTarget | null): HTMLElement | null {return target instanceof HTMLElement ? target : null;}@@ -41,12 +43,14 @@ export function installAuthController(deps: AuthControllerDeps): AuthControllerdeps.store.updateLoginState(function(nextState) {beginMutationState(nextState.request);nextState.success = false;+ nextState.successMessage = '';});try {- await deps.api.requestMagicLink(email);+ var response = await deps.api.requestMagicLink(email);deps.store.updateLoginState(function(nextState) {succeedMutationState(nextState.request);nextState.success = true;+ nextState.successMessage = String(response && response.message || '').trim() || GENERIC_MAGIC_LINK_MESSAGE;});return;} catch (error) {@@ -54,6 +58,7 @@ export function installAuthController(deps: AuthControllerDeps): AuthControllerdeps.store.updateLoginState(function(nextState) {succeedMutationState(nextState.request);nextState.success = true;+ nextState.successMessage = GENERIC_MAGIC_LINK_MESSAGE;});return;}@@ -81,6 +86,7 @@ export function installAuthController(deps: AuthControllerDeps): AuthControllerevent.preventDefault();deps.store.updateLoginState(function(nextState) {nextState.success = false;+ nextState.successMessage = '';resetMutationState(nextState.request);});void sendMagicLink();diff --git a/internal/cloudcp/portal/frontend/src/shell_view.test.ts b/internal/cloudcp/portal/frontend/src/shell_view.test.tsindex 3e440ac689..33aeb17f38 100644--- a/internal/cloudcp/portal/frontend/src/shell_view.test.ts+++ b/internal/cloudcp/portal/frontend/src/shell_view.test.ts@@ -36,6 +36,7 @@ function createLoginState(overrides: Partial<PortalLoginState> = {}): PortalLogierror: '',},success: false,+ successMessage: '',...overrides,};}@@ -143,6 +144,7 @@ describe('shell view', function() {loginState: createLoginState({emailValue: '[email protected]',success: true,+ successMessage: "If that email is registered, you'll receive a magic link shortly.",request: {pending: false,error: '',@@ -153,7 +155,7 @@ describe('shell view', function() {expect(errorHTML).toContain('value="[email protected]"');expect(errorHTML).toContain('Invalid email');- expect(successHTML).toContain('Magic link sent.');+ expect(successHTML).toContain("If that email is registered, you'll receive a magic link shortly.");expect(successHTML).toContain('data-portal-action="resend-magic-link"');});});diff --git a/internal/cloudcp/portal/frontend/src/shell_view.ts b/internal/cloudcp/portal/frontend/src/shell_view.tsindex 2b414084d9..fd771f374b 100644--- a/internal/cloudcp/portal/frontend/src/shell_view.ts+++ b/internal/cloudcp/portal/frontend/src/shell_view.ts@@ -286,7 +286,7 @@ export function renderSignedOutPortalHTML(context: ShellViewContext): string {} else if (context.loginState.success) {statusHTML ='<div class="service-status visible success">' +- 'Magic link sent. Check your inbox and click the link to sign in.' ++ escapeHTML(context.loginState.successMessage || "If that email is registered, you'll receive a magic link shortly.") +'<br><br><strong>Don\'t see it?</strong> <a href="#" data-portal-action="resend-magic-link">Send a new link</a>.' +'</div>';}diff --git a/internal/cloudcp/portal/frontend/src/state.ts b/internal/cloudcp/portal/frontend/src/state.tsindex f2af3742fa..6615c43846 100644--- a/internal/cloudcp/portal/frontend/src/state.ts+++ b/internal/cloudcp/portal/frontend/src/state.ts@@ -39,6 +39,7 @@ export function createPortalLoginState(): PortalLoginState {emailValue: '',request: createMutationState(),success: false,+ successMessage: '',};}diff --git a/internal/cloudcp/portal/frontend/src/types.ts b/internal/cloudcp/portal/frontend/src/types.tsindex 9c8cbd5877..dca82d14f9 100644--- a/internal/cloudcp/portal/frontend/src/types.ts+++ b/internal/cloudcp/portal/frontend/src/types.ts@@ -37,6 +37,7 @@ export interface PortalLoginState {emailValue: string;request: PortalMutationState;success: boolean;+ successMessage: string;}export interface PortalTeamMember {