tsc
This commit is contained in:
parent
08073b927c
commit
19e08cf803
4 changed files with 8 additions and 6 deletions
|
@ -6,7 +6,7 @@ import { t } from "i18next";
|
|||
import LinkButton from "@ente/shared/components/LinkButton";
|
||||
|
||||
interface Iprops {
|
||||
twoFactorSecret: TwoFactorSecret;
|
||||
twoFactorSecret?: TwoFactorSecret;
|
||||
changeToQRMode: () => void;
|
||||
}
|
||||
export default function SetupManualMode({
|
||||
|
|
|
@ -7,7 +7,7 @@ import { Typography } from "@mui/material";
|
|||
import { LoadingQRCode, QRCode } from "../styledComponents";
|
||||
|
||||
interface Iprops {
|
||||
twoFactorSecret: TwoFactorSecret;
|
||||
twoFactorSecret?: TwoFactorSecret;
|
||||
changeToManualMode: () => void;
|
||||
}
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ import { VerticallyCentered } from "@ente/shared/components/Container";
|
|||
import { useState } from "react";
|
||||
|
||||
interface Iprops {
|
||||
twoFactorSecret: TwoFactorSecret;
|
||||
twoFactorSecret?: TwoFactorSecret;
|
||||
}
|
||||
export function TwoFactorSetup({ twoFactorSecret }: Iprops) {
|
||||
const [setupMode, setSetupMode] = useState<SetupMode>(SetupMode.QR_CODE);
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import log from "@/next/log";
|
||||
import { ensure } from "@/utils/ensure";
|
||||
import { enableTwoFactor, setupTwoFactor } from "@ente/accounts/api/user";
|
||||
import VerifyTwoFactor, {
|
||||
type VerifyTwoFactorCallback,
|
||||
|
@ -23,8 +24,9 @@ export enum SetupMode {
|
|||
}
|
||||
|
||||
export default function SetupTwoFactor({ appName }: PageProps) {
|
||||
const [twoFactorSecret, setTwoFactorSecret] =
|
||||
useState<TwoFactorSecret>(null);
|
||||
const [twoFactorSecret, setTwoFactorSecret] = useState<
|
||||
TwoFactorSecret | undefined
|
||||
>();
|
||||
|
||||
const router = useRouter();
|
||||
|
||||
|
@ -48,7 +50,7 @@ export default function SetupTwoFactor({ appName }: PageProps) {
|
|||
markSuccessful,
|
||||
) => {
|
||||
const recoveryEncryptedTwoFactorSecret = await encryptWithRecoveryKey(
|
||||
twoFactorSecret.secretCode,
|
||||
ensure(twoFactorSecret).secretCode,
|
||||
);
|
||||
await enableTwoFactor(otp, recoveryEncryptedTwoFactorSecret);
|
||||
await markSuccessful();
|
||||
|
|
Loading…
Reference in a new issue