This commit is contained in:
Manav Rathi 2024-05-25 15:34:39 +05:30
parent 533e6d06e7
commit 4b896d3aab
No known key found for this signature in database
5 changed files with 17 additions and 9 deletions

View file

@ -68,7 +68,8 @@ function ChangeEmailForm({ appName }: PageProps) {
};
const goToApp = () => {
router.push(APP_HOMES.get(appName));
// TODO: Refactor the type of APP_HOMES to not require the ??
router.push(APP_HOMES.get(appName) ?? "/");
};
return (

View file

@ -121,7 +121,8 @@ export default function ChangePassword({ appName }: PageProps) {
const redirectToAppHome = () => {
setData(LS_KEYS.SHOW_BACK_BUTTON, { value: true });
router.push(APP_HOMES.get(appName));
// TODO: Refactor the type of APP_HOMES to not require the ??
router.push(APP_HOMES.get(appName) ?? "/");
};
return (

View file

@ -86,7 +86,8 @@ export default function Credentials({ appContext, appName }: PageProps) {
}
const token = getToken();
if (key && token) {
router.push(APP_HOMES.get(appName));
// TODO: Refactor the type of APP_HOMES to not require the ??
router.push(APP_HOMES.get(appName) ?? "/");
return;
}
const kekEncryptedAttributes: B64EncryptionResult = getKey(

View file

@ -1,4 +1,5 @@
import log from "@/next/log";
import { ensure } from "@/utils/ensure";
import { putAttributes } from "@ente/accounts/api/user";
import SetPasswordForm, {
type SetPasswordFormProps,
@ -55,7 +56,8 @@ export default function Generate({ appContext, appName }: PageProps) {
setRecoveryModalView(true);
setLoading(false);
} else {
router.push(APP_HOMES.get(appName));
// TODO: Refactor the type of APP_HOMES to not require the ??
router.push(APP_HOMES.get(appName) ?? "/");
}
} else if (keyAttributes?.encryptedKey) {
router.push(PAGES.CREDENTIALS);
@ -76,7 +78,8 @@ export default function Generate({ appContext, appName }: PageProps) {
const { keyAttributes, masterKey, srpSetupAttributes } =
await generateKeyAndSRPAttributes(passphrase);
await putAttributes(token, keyAttributes);
// TODO: Refactor the code to not require this ensure
await putAttributes(ensure(token), keyAttributes);
await configureSRP(srpSetupAttributes);
await generateAndSaveIntermediateKeyAttributes(
passphrase,
@ -94,7 +97,7 @@ export default function Generate({ appContext, appName }: PageProps) {
return (
<>
{loading ? (
{loading || !user ? (
<VerticallyCentered>
<EnteSpinner />
</VerticallyCentered>
@ -104,7 +107,8 @@ export default function Generate({ appContext, appName }: PageProps) {
show={recoverModalView}
onHide={() => {
setRecoveryModalView(false);
router.push(APP_HOMES.get(appName));
// TODO: Refactor the type of APP_HOMES to not require the ??
router.push(APP_HOMES.get(appName) ?? "/");
}}
/* TODO: Why is this error being ignored */
somethingWentWrong={() => {}}
@ -114,7 +118,7 @@ export default function Generate({ appContext, appName }: PageProps) {
<FormPaper>
<FormTitle>{t("SET_PASSPHRASE")}</FormTitle>
<SetPasswordForm
userEmail={user?.email}
userEmail={user.email}
callback={onSubmit}
buttonText={t("SET_PASSPHRASE")}
/>

View file

@ -53,7 +53,8 @@ export default function Recover({ appContext, appName }: PageProps) {
if (!keyAttributes) {
router.push(PAGES.GENERATE);
} else if (key) {
router.push(APP_HOMES.get(appName));
// TODO: Refactor the type of APP_HOMES to not require the ??
router.push(APP_HOMES.get(appName) ?? "/");
} else {
setKeyAttributes(keyAttributes);
}