@ofidj/generator-fidj 1.7.2 → 1.7.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -467,17 +467,21 @@ function render() {
|
|
|
467
467
|
signInPassword = password;
|
|
468
468
|
signInAgreementAccepted = agreement?.checked === true;
|
|
469
469
|
const acceptance = acceptedAgreement(event.currentTarget as HTMLFormElement);
|
|
470
|
-
if (!acceptance) {
|
|
471
|
-
failed = true;
|
|
472
|
-
message = "Please accept the service agreement before continuing.";
|
|
473
|
-
render();
|
|
474
|
-
return;
|
|
475
|
-
}
|
|
476
470
|
const submitter = event.submitter as HTMLButtonElement | null;
|
|
477
471
|
const signup = submitter?.name === "signup";
|
|
478
472
|
// Which door was used. The Fidj one leaves for the provider; the credential
|
|
479
473
|
// one signs in here, which is why it is the app's own form and not Fidj's.
|
|
480
474
|
const throughFidj = submitter?.name === "entry" && submitter.value === "fidj";
|
|
475
|
+
// Only the credential door is gated here. The Fidj one is about to be asked
|
|
476
|
+
// the same question on the screen that names this app, where the answer is
|
|
477
|
+
// recorded with its version — so asking first cost a second click and kept
|
|
478
|
+
// nothing.
|
|
479
|
+
if (!throughFidj && !acceptance) {
|
|
480
|
+
failed = true;
|
|
481
|
+
message = "Please accept the service agreement before continuing.";
|
|
482
|
+
render();
|
|
483
|
+
return;
|
|
484
|
+
}
|
|
481
485
|
void action(async () => {
|
|
482
486
|
if (oidc && throughFidj) {window.location.assign(await oidc.beginLogin()); return;}
|
|
483
487
|
if (oidc && (!email || !password)) {
|
|
@@ -137,9 +137,14 @@ function render() {
|
|
|
137
137
|
const password = el<HTMLInputElement>("password")?.value || "";
|
|
138
138
|
signInEmail = email;
|
|
139
139
|
signInPassword = password;
|
|
140
|
-
signInAgreementAccepted =
|
|
140
|
+
signInAgreementAccepted =
|
|
141
|
+
el<HTMLInputElement>("service-agreement")?.checked === true;
|
|
141
142
|
const acceptance = acceptedAgreement(event.currentTarget as HTMLFormElement);
|
|
142
|
-
|
|
143
|
+
// Only a credential entry is gated here. When Fidj is the door, it asks for
|
|
144
|
+
// this app's agreement a moment later, on the screen that names the app,
|
|
145
|
+
// and records the acceptance with its version — so asking first cost a
|
|
146
|
+
// second click and kept nothing.
|
|
147
|
+
if (!oidc && !acceptance) {
|
|
143
148
|
error = "Please accept the service agreement before continuing.";
|
|
144
149
|
render();
|
|
145
150
|
return;
|
|
@@ -20,7 +20,10 @@ export function signInErrorMessage(error: unknown) {
|
|
|
20
20
|
|
|
21
21
|
export async function bindAgreement(form: HTMLFormElement | null, title: string, endpoint: string, appId: string, checked = false) {
|
|
22
22
|
if (!form) return;
|
|
23
|
-
|
|
23
|
+
// An app whose only door is Fidj carries no agreement block: Fidj asks for
|
|
24
|
+
// this app's agreement on the screen that names it, and records the version.
|
|
25
|
+
const checkbox = form.querySelector<HTMLInputElement>("#service-agreement");
|
|
26
|
+
if (!checkbox) return;
|
|
24
27
|
const read = form.querySelector<HTMLButtonElement>("#read-agreement")!;
|
|
25
28
|
const dialog = form.querySelector<HTMLDialogElement>("#agreement-dialog")!;
|
|
26
29
|
const status = form.querySelector<HTMLElement>("#agreement-status")!;
|
|
@@ -130,7 +133,10 @@ export function providerEntry(
|
|
|
130
133
|
const fidj = hint
|
|
131
134
|
? `<button class="primary" type="submit" name="entry" value="fidj">Continue as ${escapeText(hint)}</button><button type="button" id="forget-hint" class="quiet">Use a different account</button>`
|
|
132
135
|
: `<button class="${both ? "secondary" : "primary"}" type="submit" name="entry" value="fidj">${isFidjItself ? "Sign in" : "Sign in with Fidj"}</button>`;
|
|
133
|
-
|
|
136
|
+
// Fidj is the only door: it collects the agreement itself, a moment later, on
|
|
137
|
+
// the screen that names the app — and records it with its version. Collecting
|
|
138
|
+
// it here first recorded nothing and asked the same question twice.
|
|
139
|
+
if (!both) return lead + fidj;
|
|
134
140
|
// Both doors. A remembered address puts Fidj first because it is one tap; no
|
|
135
141
|
// memory puts the form first, because that is what the person came to do.
|
|
136
142
|
const divider = `<div class="signin-divider"><span>or</span></div>`;
|