@ofidj/generator-fidj 1.7.1 → 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.
@@ -443,7 +443,10 @@ function render() {
443
443
 
444
444
  // Forgetting the address it remembered and handing the person back to a
445
445
  // session it never ended would recognise them again: the offer has to reach
446
- // the provider, not just this browser's memory.
446
+ // the provider, not just this browser's memory. Asking for re-authentication
447
+ // is how it says so, and the provider reads it as this person saying they are
448
+ // not the one it knows — it ends that session when it hands the screen over,
449
+ // so walking away from the form does not hand the old face back.
447
450
  element("forget-hint")?.addEventListener("click", () => {
448
451
  forgetSignIn(config.appId);
449
452
  if (oidc) {
@@ -464,17 +467,21 @@ function render() {
464
467
  signInPassword = password;
465
468
  signInAgreementAccepted = agreement?.checked === true;
466
469
  const acceptance = acceptedAgreement(event.currentTarget as HTMLFormElement);
467
- if (!acceptance) {
468
- failed = true;
469
- message = "Please accept the service agreement before continuing.";
470
- render();
471
- return;
472
- }
473
470
  const submitter = event.submitter as HTMLButtonElement | null;
474
471
  const signup = submitter?.name === "signup";
475
472
  // Which door was used. The Fidj one leaves for the provider; the credential
476
473
  // one signs in here, which is why it is the app's own form and not Fidj's.
477
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
+ }
478
485
  void action(async () => {
479
486
  if (oidc && throughFidj) {window.location.assign(await oidc.beginLogin()); return;}
480
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 = el<HTMLInputElement>("service-agreement").checked;
140
+ signInAgreementAccepted =
141
+ el<HTMLInputElement>("service-agreement")?.checked === true;
141
142
  const acceptance = acceptedAgreement(event.currentTarget as HTMLFormElement);
142
- if (!acceptance) {
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
- const checkbox = form.querySelector<HTMLInputElement>("#service-agreement")!;
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
- if (!both) return lead + agreementMarkup() + fidj;
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>`;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ofidj/generator-fidj",
3
- "version": "1.7.1",
3
+ "version": "1.7.3",
4
4
  "description": "Generate a TypeScript app with Fidj sign-in, live server-side roles and per-app privacy.",
5
5
  "homepage": "https://fidj.ovh",
6
6
  "bugs": {