Multiplayer agent harness for work.
Make configured company sign-in primary over email (#1314)
Regan Bell358c499c703a
diff --git a/docs/screenshots/trusted-login-primary.png b/docs/screenshots/trusted-login-primary.pngnew file mode 100644index 000000000..5f9dee079Binary files /dev/null and b/docs/screenshots/trusted-login-primary.png differdiff --git a/plugins/auth/src/pages.ts b/plugins/auth/src/pages.tsindex 3f86f2cb4..2d45a772a 100644--- a/plugins/auth/src/pages.ts+++ b/plugins/auth/src/pages.ts@@ -126,18 +126,19 @@ export function emailFormPage(o: {return page({title: "Sign in",brandName: o.brandName,- trustedSignInLabel: o.trustedSignInLabel,- icon: MAIL_ICON,+ icon: o.trustedSignInLabel ? LOCK_ICON : MAIL_ICON,heading: `Sign in to ${o.brandName}`,- msg: "Enter your work email and we'll send you a one-time sign-in link.",- body: `${o.problem ? `<p class="reason"><strong>Try again</strong>${escapeHtml(o.problem)}</p>` : ""}<form method="post" action="${escapeHtml(o.action)}">+ msg: o.trustedSignInLabel+ ? `Use your ${o.trustedSignInLabel} account to continue.`+ : "Enter your work email and we'll send you a one-time sign-in link.",+ body: `${o.trustedSignInLabel ? `<a class="btn" href="/auth/trusted/login">Sign in with ${escapeHtml(o.trustedSignInLabel)}</a><div class="divider">OR</div>` : ""}${o.problem ? `<p class="reason"><strong>Try again</strong>${escapeHtml(o.problem)}</p>` : ""}<form method="post" action="${escapeHtml(o.action)}"><input type="hidden" name="request" value="${escapeHtml(o.requestToken)}"><label for="email">Email address</label>- <input id="email" name="email" type="email" autocomplete="email" inputmode="email" required autofocus+ <input id="email" name="email" type="email" autocomplete="email" inputmode="email" required${o.trustedSignInLabel ? "" : " autofocus"}spellcheck="false" maxlength="254" placeholder="[email protected]" value="${escapeHtml(o.email ?? "")}">- <button class="btn" type="submit">Email me a sign-in link</button>+ <button class="btn${o.trustedSignInLabel ? " alternative" : ""}" type="submit">Email me a sign-in link</button></form>`,- help: "Only addresses your administrator has allowed can sign in.",+ help: "For email sign-in, use an address your administrator has allowed.",});}diff --git a/plugins/auth/test/flow.test.ts b/plugins/auth/test/flow.test.tsindex 5160a7f3a..0e02ce1c9 100644--- a/plugins/auth/test/flow.test.ts+++ b/plugins/auth/test/flow.test.ts@@ -757,7 +757,14 @@ test("trusted sign-in is available throughout the email flow only when configureconst page = await fetch(`${h.base}/authorize?${authorizeQuery()}`);const html = await page.text();assert.equal(html.includes('href="/auth/trusted/login"'), Boolean(trustedSignInLabel));- if (trustedSignInLabel) assert.match(html, /Sign in with Company SSO/);+ if (trustedSignInLabel) {+ assert.match(html, /Sign in with Company SSO/);+ assert.ok(html.indexOf('href="/auth/trusted/login"') < html.indexOf("<form"));+ assert.match(html, /class="btn alternative" type="submit"/);+ assert.doesNotMatch(html, /autofocus/);+ } else {+ assert.match(html, /required autofocus/);+ }const request = hiddenRequestToken(html);for (const email of ["invalid", "[email protected]"]) {const response = await fetch(`${h.base}/authorize`, form({ request, email }));