@ofidj/generator-fidj 1.4.0 → 1.4.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.
|
@@ -274,6 +274,14 @@ function startModule() {
|
|
|
274
274
|
}
|
|
275
275
|
}
|
|
276
276
|
function render() {
|
|
277
|
+
// Once the mounted app owns the document the shell cannot draw over it, and
|
|
278
|
+
// its own router will try to match addresses that were never its business.
|
|
279
|
+
// So any address it does not own means starting the document again — checked
|
|
280
|
+
// first, because every later branch writes into an element that is gone.
|
|
281
|
+
if (moduleStarted && !moduleRoute()) {
|
|
282
|
+
window.location.reload();
|
|
283
|
+
return;
|
|
284
|
+
}
|
|
277
285
|
// The provider handed this person here to answer a question. Nothing else
|
|
278
286
|
// this app might want to show belongs on the screen until they have.
|
|
279
287
|
if (interactionId) {
|
|
@@ -299,11 +307,6 @@ function render() {
|
|
|
299
307
|
startModule();
|
|
300
308
|
return;
|
|
301
309
|
}
|
|
302
|
-
// The mounted app has taken the document; the shell cannot draw over it.
|
|
303
|
-
if (moduleStarted) {
|
|
304
|
-
window.location.reload();
|
|
305
|
-
return;
|
|
306
|
-
}
|
|
307
310
|
let route = currentRoute();
|
|
308
311
|
if (
|
|
309
312
|
!signedIn &&
|
|
@@ -582,9 +585,11 @@ function readInteraction() {
|
|
|
582
585
|
if (!uid) return false;
|
|
583
586
|
interactionId = uid;
|
|
584
587
|
interactionError = parameters.get("error") || "";
|
|
585
|
-
// The
|
|
586
|
-
//
|
|
587
|
-
|
|
588
|
+
// The id stays in the address while the screen is up. Taking it out looked
|
|
589
|
+
// tidier and made the screen a trap: the address became "#/signin", so going
|
|
590
|
+
// back to "#/signin" changed nothing, the document never reloaded, and the
|
|
591
|
+
// person stayed on a screen they had asked to leave. It is single-use, it is
|
|
592
|
+
// where the provider put it, and the form navigates away from it.
|
|
588
593
|
return true;
|
|
589
594
|
}
|
|
590
595
|
|
|
@@ -609,6 +614,13 @@ function interactionScreen() {
|
|
|
609
614
|
? `<p role="alert" class="error">${escape(refusals[interactionError] || refusals.refused)}</p>`
|
|
610
615
|
: "";
|
|
611
616
|
const action = new URL(details.action, config.apiEndpoint).href;
|
|
617
|
+
// A refusal comes back as a redirect, so the typed address would be lost —
|
|
618
|
+
// and retyping an address is the part a person gets wrong twice. It is kept
|
|
619
|
+
// in this browser, never in the address: nothing about them travels in a URL.
|
|
620
|
+
let typed = "";
|
|
621
|
+
try {
|
|
622
|
+
typed = sessionStorage.getItem("fidj.interaction.email") || "";
|
|
623
|
+
} catch {}
|
|
612
624
|
const body =
|
|
613
625
|
details.prompt === "login"
|
|
614
626
|
? `<h2>Sign in to continue to ${asking}</h2>
|
|
@@ -616,7 +628,7 @@ function interactionScreen() {
|
|
|
616
628
|
${notice}
|
|
617
629
|
<form method="post" action="${escape(action)}" id="interaction">
|
|
618
630
|
<input type="hidden" name="csrf" value="${escape(details.csrf)}">
|
|
619
|
-
<label for="email">Email</label><input id="email" name="email" type="email" autocomplete="username" required>
|
|
631
|
+
<label for="email">Email</label><input id="email" name="email" type="email" value="${escape(typed)}" autocomplete="username" required>
|
|
620
632
|
<div class="field-head"><label for="password">Password</label><a href="${escape(config.dashboardUrl)}/#/forgot">Forgot?</a></div>
|
|
621
633
|
<div class="password-field"><input id="password" name="password" type="password" autocomplete="current-password" required><button type="button" id="reveal" aria-controls="password">Show</button></div>
|
|
622
634
|
<button class="primary" type="submit" name="action" value="continue">Sign in</button>
|
|
@@ -653,6 +665,13 @@ function interactionScreen() {
|
|
|
653
665
|
field.type = hidden ? "text" : "password";
|
|
654
666
|
button.textContent = hidden ? "Hide" : "Show";
|
|
655
667
|
});
|
|
668
|
+
element("interaction")?.addEventListener("submit", () => {
|
|
669
|
+
const address = element<HTMLInputElement>("email")?.value || "";
|
|
670
|
+
try {
|
|
671
|
+
if (address) sessionStorage.setItem("fidj.interaction.email", address);
|
|
672
|
+
else sessionStorage.removeItem("fidj.interaction.email");
|
|
673
|
+
} catch {}
|
|
674
|
+
});
|
|
656
675
|
}
|
|
657
676
|
|
|
658
677
|
function renderAccount(route: string) {
|
|
@@ -741,6 +760,9 @@ void action(async () => {
|
|
|
741
760
|
const callback = new URL(window.location.href);
|
|
742
761
|
window.history.replaceState(null, "", window.location.pathname + "#/content");
|
|
743
762
|
await oidc.completeLogin(callback);
|
|
763
|
+
try {
|
|
764
|
+
sessionStorage.removeItem("fidj.interaction.email");
|
|
765
|
+
} catch {}
|
|
744
766
|
}
|
|
745
767
|
await sdk.init(config.appId, {
|
|
746
768
|
apiEndpoint: config.apiEndpoint,
|