@ofidj/generator-fidj 1.6.0 → 1.7.1

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.
@@ -293,8 +293,13 @@ function render() {
293
293
  return;
294
294
  }
295
295
  // The provider handed this person here to answer a question. Nothing else
296
- // this app might want to show belongs on the screen until they have.
296
+ // this app might want to show belongs on the screen until they have — the
297
+ // shell's own header and page margins included: chrome that says "you are
298
+ // inside the console" reads as furniture from the wrong room above a question
299
+ // about whether you are anyone at all. Same class the shell's other
300
+ // standalone screens use, so one rule keeps covering them all.
297
301
  if (interactionId) {
302
+ document.body.classList.add("signin-view");
298
303
  if (interactionFailed) {
299
304
  root.innerHTML = `<section class="card"><p role="alert" class="error">${escape(message)}</p><p><a href="#/signin">Back to sign in</a></p></section>`;
300
305
  return;
@@ -436,8 +441,17 @@ function render() {
436
441
  })();
437
442
  }
438
443
 
444
+ // Forgetting the address it remembered and handing the person back to a
445
+ // session it never ended would recognise them again: the offer has to reach
446
+ // the provider, not just this browser's memory.
439
447
  element("forget-hint")?.addEventListener("click", () => {
440
448
  forgetSignIn(config.appId);
449
+ if (oidc) {
450
+ void (async () => {
451
+ window.location.assign(await oidc.beginLogin({prompt: "login"}));
452
+ })();
453
+ return;
454
+ }
441
455
  render();
442
456
  });
443
457
  void bindAgreement(element<HTMLFormElement>("signin"), config.title, config.apiEndpoint, config.appId, signInAgreementAccepted);
@@ -724,6 +738,7 @@ function interactionScreen() {
724
738
  <label class="agreement-choice"><input type="checkbox" name="terms" value="true" required><span>I accept ${asking}'s service agreement.</span></label>
725
739
  ${details.termsUri ? `<p class="fineprint"><a href="${escape(details.termsUri)}" target="_blank" rel="noopener noreferrer">Service agreement</a>${details.privacyUri ? ` · <a href="${escape(details.privacyUri)}" target="_blank" rel="noopener noreferrer">Privacy notice</a>` : ""}</p>` : ""}
726
740
  <button class="primary" type="submit" name="action" value="continue">Allow and continue</button>
741
+ <button class="quiet" type="submit" id="not-me" name="action" value="switch" formnovalidate>Not you? Sign in with another account</button>
727
742
  <button class="quiet" type="submit" name="action" value="cancel" formnovalidate>Cancel and go back</button>
728
743
  </form>`;
729
744
 
@@ -742,6 +757,19 @@ function interactionScreen() {
742
757
  field.type = hidden ? "text" : "password";
743
758
  button.textContent = hidden ? "Hide" : "Show";
744
759
  });
760
+ // Being recognised is the point, and a dead end when the person is not who
761
+ // Fidj thinks — a shared computer, a second account, somebody else's tab. So
762
+ // the screen that recognises them asks again on request. It goes back to the
763
+ // provider as this form's own answer, because only the provider can end the
764
+ // session doing the recognising: starting a fresh request with prompt=login
765
+ // from here asked once and left that session standing, so the back button,
766
+ // a reload, or the app's door again met the same face.
767
+ element("not-me")?.addEventListener("click", () => {
768
+ forgetSignIn(config.appId);
769
+ try {
770
+ sessionStorage.removeItem("fidj.interaction.email");
771
+ } catch {}
772
+ });
745
773
  element("interaction")?.addEventListener("submit", () => {
746
774
  const address = element<HTMLInputElement>("email")?.value || "";
747
775
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ofidj/generator-fidj",
3
- "version": "1.6.0",
3
+ "version": "1.7.1",
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": {