Skip to content

Commit

Permalink
Add temp key warning to registration success screen (#1916)
Browse files Browse the repository at this point in the history
* Add temp key warning to registration success screen

This adds the temp key warning also to the registration success page.

* Rename slot to marketingIntroSlot
  • Loading branch information
Frederik Rothenberger authored Sep 20, 2023
1 parent dc9cd1e commit fe27841
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/frontend/src/flows/register/finish.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,14 @@ export const displayUserNumberTemplate = ({
userNumber,
identityBackground,
stepper,
marketingIntroSlot,
scrollToTop = false,
}: {
onContinue: () => void;
userNumber: bigint;
identityBackground: IdentityBackground;
stepper: TemplateResult;
marketingIntroSlot?: TemplateResult;
/* put the page into view */
scrollToTop?: boolean;
}) => {
Expand Down Expand Up @@ -84,6 +86,7 @@ export const displayUserNumberTemplate = ({
I saved it, continue
</button>
<section class="c-marketing-block">
${marketingIntroSlot}
<aside class="l-stack">
<h3 class="t-title">This number is your Internet Identity</h3>
<p class="t-paragraph">With your Internet Identity and your passkey, you will be able to create and securely connect to Internet Computer dapps</p>
Expand Down Expand Up @@ -126,17 +129,20 @@ export const displayUserNumber = ({
userNumber,
identityBackground,
stepper,
marketingIntroSlot,
}: {
userNumber: bigint;
identityBackground: IdentityBackground;
stepper: TemplateResult;
marketingIntroSlot?: TemplateResult;
}): Promise<void> => {
return new Promise((resolve) =>
displayUserNumberPage({
onContinue: () => resolve(),
userNumber,
identityBackground,
stepper,
marketingIntroSlot,
scrollToTop: true,
})
);
Expand Down
6 changes: 6 additions & 0 deletions src/frontend/src/flows/register/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,13 @@ import {
PinIdentityMaterial,
constructPinIdentity,
} from "$src/crypto/pinIdentity";
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 { authenticatorAttachmentToKeyType } from "$src/utils/authenticatorAttachment";
import { LoginFlowCanceled } from "$src/utils/flowResult";
import {
Expand Down Expand Up @@ -98,6 +100,7 @@ export const registerFlow = async <T>({
keyType: { browser_storage_key: null },
finalizeIdentity: (userNumber: bigint) =>
storePinIdentity({ userNumber, pinIdentityMaterial }),
finishSlot: tempKeyWarningBox({ i18n: new I18n() }),
};
} else {
const identity = savePasskeyResult;
Expand Down Expand Up @@ -131,6 +134,7 @@ export const registerFlow = async <T>({
credentialId,
keyType,
finalizeIdentity,
finishSlot,
}: {
identity: SignIdentity;
alias: string;
Expand All @@ -139,6 +143,7 @@ export const registerFlow = async <T>({
credentialId?: CredentialId;
keyType: KeyType;
finalizeIdentity?: (userNumber: bigint) => Promise<void>;
finishSlot?: TemplateResult;
} = result_;

const result = await promptCaptcha({
Expand Down Expand Up @@ -173,6 +178,7 @@ export const registerFlow = async <T>({
await displayUserNumber({
userNumber,
stepper: finishStepper,
marketingIntroSlot: finishSlot,
});
}
return result;
Expand Down
1 change: 1 addition & 0 deletions src/showcase/src/pages/[page].astro
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import Layout from "../layouts/Layout.astro";
import "$src/styles/main.css";
export const iiPageNames = [
"displayUserNumber",
"displayUserNumberTempKey",
"compatibilityNotice",
"promptDeviceAlias",
"authorizeNew",
Expand Down
9 changes: 9 additions & 0 deletions src/showcase/src/showcase.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import {
resetPhraseInfoPage,
unprotectDeviceInfoPage,
} from "$src/flows/manage/deviceSettings";
import { tempKeyWarningBox } from "$src/flows/manage/tempKeys";
import { confirmPinPage } from "$src/flows/pin/confirmPin";
import { pinInfoPage } from "$src/flows/pin/pinInfo";
import { setPinPage } from "$src/flows/pin/setPin";
Expand Down Expand Up @@ -149,6 +150,14 @@ export const iiPages: Record<string, () => void> = {
onContinue: () => console.log("done"),
stepper: registerStepper({ current: "finish" }),
}),
displayUserNumberTempKey: () =>
displayUserNumberPage({
identityBackground,
userNumber,
onContinue: () => console.log("done"),
stepper: registerStepper({ current: "finish" }),
marketingIntroSlot: tempKeyWarningBox({ i18n: new I18n("en") }),
}),
compatibilityNotice: () => compatibilityNotice("This is the reason."),
promptDeviceAlias: () =>
promptDeviceAliasPage({
Expand Down

0 comments on commit fe27841

Please sign in to comment.