π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
tsc
Manav Rathi1f45cf00c783
diff --git a/web/packages/accounts/components/ChangeEmail.tsx b/web/packages/accounts/components/ChangeEmail.tsxindex bb29893bf9..75eb822561 100644--- a/web/packages/accounts/components/ChangeEmail.tsx+++ b/web/packages/accounts/components/ChangeEmail.tsx@@ -1,3 +1,4 @@+import { ensure } from "@/utils/ensure";import { wait } from "@/utils/promise";import { changeEmail, sendOTTForEmailChange } from "@ente/accounts/api/user";import { APP_HOMES } from "@ente/shared/apps/constants";@@ -13,6 +14,7 @@ import { t } from "i18next";import { useRouter } from "next/router";import { useRef, useState } from "react";import { Trans } from "react-i18next";+import OtpInput from "react-otp-input";import * as Yup from "yup";interface formValues {@@ -23,7 +25,7 @@ interface formValues {function ChangeEmailForm({ appName }: PageProps) {const [loading, setLoading] = useState(false);const [ottInputVisible, setShowOttInputVisibility] = useState(false);- const ottInputRef = useRef(null);+ const ottInputRef = useRef<OtpInput>(null);const [email, setEmail] = useState(null);const [showMessage, setShowMessage] = useState(false);const [success, setSuccess] = useState(false);@@ -55,7 +57,7 @@ function ChangeEmailForm({ appName }: PageProps) {) => {try {setLoading(true);- await changeEmail(email, ott);+ await changeEmail(email, ensure(ott));setData(LS_KEYS.USER, { ...getData(LS_KEYS.USER), email });setLoading(false);setSuccess(true);@@ -75,12 +77,20 @@ function ChangeEmailForm({ appName }: PageProps) {return (<Formik<formValues>initialValues={{ email: "" }}- validationSchema={Yup.object().shape({- email: Yup.string()- .email(t("EMAIL_ERROR"))- .required(t("REQUIRED")),- ott: ottInputVisible && Yup.string().required(t("REQUIRED")),- })}+ validationSchema={+ ottInputVisible+ ? Yup.object().shape({+ email: Yup.string()+ .email(t("EMAIL_ERROR"))+ .required(t("REQUIRED")),+ ott: Yup.string().required(t("REQUIRED")),+ })+ : Yup.object().shape({+ email: Yup.string()+ .email(t("EMAIL_ERROR"))+ .required(t("REQUIRED")),+ })+ }validateOnChange={false}validateOnBlur={false}onSubmit={!ottInputVisible ? requestOTT : requestEmailChange}@@ -149,7 +159,9 @@ function ChangeEmailForm({ appName }: PageProps) {<FormPaperFooterstyle={{- justifyContent: ottInputVisible && "space-between",+ justifyContent: ottInputVisible+ ? "space-between"+ : "normal",}}>{ottInputVisible && (diff --git a/web/packages/accounts/components/two-factor/VerifyForm.tsx b/web/packages/accounts/components/two-factor/VerifyForm.tsxindex f26d292d73..c89d9702ad 100644--- a/web/packages/accounts/components/two-factor/VerifyForm.tsx+++ b/web/packages/accounts/components/two-factor/VerifyForm.tsx@@ -26,7 +26,7 @@ export type VerifyTwoFactorCallback = (export default function VerifyTwoFactor(props: Props) {const [waiting, setWaiting] = useState(false);- const otpInputRef = useRef(null);+ const otpInputRef = useRef<OtpInput>(null);const [success, setSuccess] = useState(false);const markSuccessful = async () => {diff --git a/web/packages/accounts/components/two-factor/setup/ManualMode.tsx b/web/packages/accounts/components/two-factor/setup/ManualMode.tsxindex bd541a565c..c66af2cde4 100644--- a/web/packages/accounts/components/two-factor/setup/ManualMode.tsx+++ b/web/packages/accounts/components/two-factor/setup/ManualMode.tsx@@ -16,7 +16,7 @@ export default function SetupManualMode({return (<><Typography>{t("TWO_FACTOR_MANUAL_CODE_INSTRUCTION")}</Typography>- <CodeBlock code={twoFactorSecret?.secretCode} my={2} />+ <CodeBlock code={twoFactorSecret?.secretCode ?? ""} my={2} /><LinkButton onClick={changeToQRMode}>{t("SCAN_QR_CODE")}</LinkButton>