Skip to content

Commit

Permalink
Remove registration stepper
Browse files Browse the repository at this point in the history
Remove registration steppers as it no longer makes sense if the captcha
is skipped.
  • Loading branch information
Frederik Rothenberger committed Oct 17, 2024
1 parent 539b7a8 commit eee3769
Show file tree
Hide file tree
Showing 12 changed files with 0 additions and 100 deletions.
2 changes: 0 additions & 2 deletions src/frontend/src/flows/pin/confirmPin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { PinResult, pinInput } from "$src/components/pinInput";
import { I18n } from "$src/i18n";
import { mount, renderPage } from "$src/utils/lit-html";
import { TemplateResult, html } from "lit-html";
import { pinStepper } from "./stepper";

import { Chan } from "$src/utils/utils";
import { asyncReplace } from "lit-html/directives/async-replace.js";
Expand Down Expand Up @@ -64,7 +63,6 @@ const confirmPinTemplate = ({
focus,
});
const slot = html`
${pinStepper({ current: "set_pin" })}
<hgroup ${scrollToTop ? mount(() => window.scrollTo(0, 0)) : undefined}>
<h1 class="t-title t-title--main">${copy.confirm_pin}</h1>
</hgroup>
Expand Down
2 changes: 0 additions & 2 deletions src/frontend/src/flows/pin/pinInfo.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { warningIcon } from "$src/components/icons";
import { mainWindow } from "$src/components/mainWindow";
import { pinStepper } from "$src/flows/pin/stepper";
import { I18n } from "$src/i18n";
import { mount, renderPage } from "$src/utils/lit-html";
import { TemplateResult, html } from "lit-html";
Expand All @@ -22,7 +21,6 @@ const pinInfoTemplate = ({
const copy = i18n.i18n(copyJson);

const slot = html`
${pinStepper({ current: "set_pin" })}
<hgroup ${scrollToTop ? mount(() => window.scrollTo(0, 0)) : undefined}>
<h1 class="t-title t-title--main">
${copy.create_temporary_key_form_pin}
Expand Down
2 changes: 0 additions & 2 deletions src/frontend/src/flows/pin/setPin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { I18n } from "$src/i18n";
import { mount, renderPage } from "$src/utils/lit-html";
import { isNullish } from "@dfinity/utils";
import { TemplateResult, html } from "lit-html";
import { pinStepper } from "./stepper";

import { confirmPin } from "$src/flows/pin/confirmPin";
import { promptPinInfo } from "$src/flows/pin/pinInfo";
Expand Down Expand Up @@ -34,7 +33,6 @@ const setPinTemplate = ({
focus,
});
const slot = html`
${pinStepper({ current: "set_pin" })}
<hgroup ${scrollToTop ? mount(() => window.scrollTo(0, 0)) : undefined}>
<h1 class="t-title t-title--main">${copy.set_pin_for_ii}</h1>
</hgroup>
Expand Down
32 changes: 0 additions & 32 deletions src/frontend/src/flows/pin/stepper.ts

This file was deleted.

6 changes: 0 additions & 6 deletions src/frontend/src/flows/register/captcha.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ export const promptCaptchaTemplate = <T>({
checkCaptcha,
onContinue,
i18n,
stepper,
focus: focus_,
scrollToTop = false,
}: {
Expand All @@ -26,7 +25,6 @@ export const promptCaptchaTemplate = <T>({
) => Promise<Exclude<T, WrongCaptchaSolution> | WrongCaptchaSolution>;
onContinue: (result: Exclude<T, WrongCaptchaSolution>) => void;
i18n: I18n;
stepper: TemplateResult;
focus?: boolean;
/* put the page into view */
scrollToTop?: boolean;
Expand Down Expand Up @@ -146,7 +144,6 @@ export const promptCaptchaTemplate = <T>({

const promptCaptchaSlot = html`
<article ${scrollToTop ? mount(() => window.scrollTo(0, 0)) : undefined}>
${stepper}
<h1 class="t-title t-title--main">${copy.title}</h1>
<form autocomplete="off" @submit=${asyncReplace(next)} class="l-stack">
<div
Expand Down Expand Up @@ -214,11 +211,9 @@ export function promptCaptchaPage<T>(

export const promptCaptcha = <T>({
captcha_png_base64,
stepper,
checkCaptcha,
}: {
captcha_png_base64: string;
stepper: TemplateResult;
checkCaptcha: (
solution: string
) => Promise<Exclude<T, WrongCaptchaSolution> | WrongCaptchaSolution>;
Expand All @@ -231,7 +226,6 @@ export const promptCaptcha = <T>({
checkCaptcha,
onContinue: resolve,
i18n,
stepper,
scrollToTop: true,
focus: true,
});
Expand Down
7 changes: 0 additions & 7 deletions src/frontend/src/flows/register/finish.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,22 +18,18 @@ export const displayUserNumberTemplate = ({
onContinue,
userNumber,
identityBackground,
stepper,
marketingIntroSlot,
scrollToTop = false,
}: {
onContinue: () => void;
userNumber: bigint;
identityBackground: PreLoadImage;
stepper: TemplateResult;
marketingIntroSlot?: TemplateResult;
/* put the page into view */
scrollToTop?: boolean;
}) => {
const userNumberCopy: Ref<HTMLButtonElement> = createRef();
const displayUserNumberSlot = html`
${stepper}
<hgroup
${scrollToTop ? mount(() => window.scrollTo(0, 0)) : undefined}
Expand Down Expand Up @@ -126,20 +122,17 @@ export const displayUserNumberWarmup = (): OmitParams<
export const displayUserNumber = ({
userNumber,
identityBackground,
stepper,
marketingIntroSlot,
}: {
userNumber: bigint;
identityBackground: PreLoadImage;
stepper: TemplateResult;
marketingIntroSlot?: TemplateResult;
}): Promise<void> => {
return new Promise((resolve) =>
displayUserNumberPage({
onContinue: () => resolve(),
userNumber,
identityBackground,
stepper,
marketingIntroSlot,
scrollToTop: true,
})
Expand Down
12 changes: 0 additions & 12 deletions src/frontend/src/flows/register/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ import {
import { tempKeyWarningBox } from "$src/flows/manage/tempKeys";
import { idbStorePinIdentityMaterial } from "$src/flows/pin/idb";
import { setPinFlow } from "$src/flows/pin/setPin";
import { pinStepper } from "$src/flows/pin/stepper";
import { registerStepper } from "$src/flows/register/stepper";
import { registerDisabled } from "$src/flows/registerDisabled";
import { I18n } from "$src/i18n";
import { setAnchorUsed } from "$src/storage";
Expand Down Expand Up @@ -140,8 +138,6 @@ export const registerFlow = async ({
alias,
pubKey: identity.getPublicKey().toDer(),
}),
captchaStepper: pinStepper({ current: "captcha" }),
finishStepper: pinStepper({ current: "finish" }),
finalizeIdentity: (userNumber: bigint) =>
storePinIdentity({ userNumber, pinIdentityMaterial }),
finishSlot: tempKeyWarningBox({ i18n: new I18n() }),
Expand All @@ -162,8 +158,6 @@ export const registerFlow = async ({
credentialId: identity.rawId,
authenticatorAttachment: identity.getAuthenticatorAttachment(),
}),
captchaStepper: registerStepper({ current: "captcha" }),
finishStepper: registerStepper({ current: "finish" }),
authnMethod: "passkey" as const,
};
}
Expand All @@ -176,16 +170,12 @@ export const registerFlow = async ({
const {
identity,
authnMethodData,
captchaStepper,
finishStepper,
finalizeIdentity,
finishSlot,
authnMethod,
}: {
identity: SignIdentity;
authnMethodData: AuthnMethodData;
captchaStepper: TemplateResult;
finishStepper: TemplateResult;
finalizeIdentity?: (userNumber: bigint) => Promise<void>;
finishSlot?: TemplateResult;
authnMethod: "pin" | "passkey";
Expand All @@ -200,7 +190,6 @@ export const registerFlow = async ({
if (startResult.nextStep.step === "checkCaptcha") {
const captchaResult = await promptCaptcha({
captcha_png_base64: startResult.nextStep.captcha_png_base64,
stepper: captchaStepper,
checkCaptcha,
});
if (captchaResult === "canceled") {
Expand Down Expand Up @@ -240,7 +229,6 @@ export const registerFlow = async ({
]);
await displayUserNumber({
userNumber,
stepper: finishStepper,
marketingIntroSlot: finishSlot,
});
return { ...result, authnMethod };
Expand Down
2 changes: 0 additions & 2 deletions src/frontend/src/flows/register/passkey.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import {
} from "$src/utils/webAuthnErrorUtils";
import { nonNullish } from "@dfinity/utils";
import { html, TemplateResult } from "lit-html";
import { registerStepper } from "./stepper";

import copyJson from "./passkey.json";

Expand Down Expand Up @@ -44,7 +43,6 @@ const savePasskeyTemplate = ({
`;

const slot = html`
${registerStepper({ current: "create" })}
<hgroup ${scrollToTop ? mount(() => window.scrollTo(0, 0)) : undefined}>
<h1 class="t-title t-title--main">${copy.save_passkey}</h1>
<p class="t-paragraph">
Expand Down
29 changes: 0 additions & 29 deletions src/frontend/src/flows/register/stepper.ts

This file was deleted.

2 changes: 0 additions & 2 deletions src/showcase/src/pages/displayUserNumber.astro
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import Screen from "../layouts/Screen.astro";
import { toast } from "$src/components/toast";
import { userNumber } from "../constants";
import { displayUserNumberPage } from "$src/flows/register/finish";
import { registerStepper } from "$src/flows/register/stepper";
import identityCardBackground from "$src/assets/identityCardBackground.png";
import { PreLoadImage } from "$src/utils/preLoadImage";

Expand All @@ -17,7 +16,6 @@ import Screen from "../layouts/Screen.astro";
identityBackground,
userNumber,
onContinue: () => toast.info("done"),
stepper: registerStepper({ current: "finish" }),
});
</script>
</Screen>
2 changes: 0 additions & 2 deletions src/showcase/src/pages/displayUserNumberTempKey.astro
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import Screen from "../layouts/Screen.astro";
import { userNumber } from "../constants";
import { i18n } from "../i18n";
import { displayUserNumberPage } from "$src/flows/register/finish";
import { registerStepper } from "$src/flows/register/stepper";
import { tempKeyWarningBox } from "$src/flows/manage/tempKeys";
import identityCardBackground from "$src/assets/identityCardBackground.png";
import { PreLoadImage } from "$src/utils/preLoadImage";
Expand All @@ -19,7 +18,6 @@ import Screen from "../layouts/Screen.astro";
identityBackground,
userNumber,
onContinue: () => toast.info("done"),
stepper: registerStepper({ current: "finish" }),
marketingIntroSlot: tempKeyWarningBox({ i18n }),
});
</script>
Expand Down
2 changes: 0 additions & 2 deletions src/showcase/src/pages/promptCaptcha.astro
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import Screen from "../layouts/Screen.astro";
<script>
import { toast } from "$src/components/toast";
import { i18n } from "../i18n";
import { registerStepper } from "$src/flows/register/stepper";
import { promptCaptchaPage } from "$src/flows/register/captcha";
import { dummyChallenge } from "../constants";

Expand All @@ -24,7 +23,6 @@ import Screen from "../layouts/Screen.astro";
}
return undefined;
},
stepper: registerStepper({ current: "captcha" }),
onContinue: () => toast.info("Done"),
i18n,
});
Expand Down

0 comments on commit eee3769

Please sign in to comment.