creds
This commit is contained in:
parent
17b49595a0
commit
ca00b3b558
1 changed files with 9 additions and 5 deletions
|
@ -1,7 +1,7 @@
|
||||||
import { isDevBuild } from "@/next/env";
|
import { isDevBuild } from "@/next/env";
|
||||||
import log from "@/next/log";
|
import log from "@/next/log";
|
||||||
import { ensure } from "@/utils/ensure";
|
import { ensure } from "@/utils/ensure";
|
||||||
import { APP_HOMES } from "@ente/shared/apps/constants";
|
import { APP_HOMES, appNameToAppNameOld } from "@ente/shared/apps/constants";
|
||||||
import type { PageProps } from "@ente/shared/apps/types";
|
import type { PageProps } from "@ente/shared/apps/types";
|
||||||
import { VerticallyCentered } from "@ente/shared/components/Container";
|
import { VerticallyCentered } from "@ente/shared/components/Container";
|
||||||
import EnteSpinner from "@ente/shared/components/EnteSpinner";
|
import EnteSpinner from "@ente/shared/components/EnteSpinner";
|
||||||
|
@ -53,8 +53,10 @@ import {
|
||||||
} from "../services/srp";
|
} from "../services/srp";
|
||||||
import type { SRPAttributes } from "../types/srp";
|
import type { SRPAttributes } from "../types/srp";
|
||||||
|
|
||||||
export default function Credentials({ appContext, appName }: PageProps) {
|
const Page: React.FC<PageProps> = ({ appContext }) => {
|
||||||
const { logout } = appContext;
|
const { appName, logout } = appContext;
|
||||||
|
|
||||||
|
const appNameOld = appNameToAppNameOld(appName);
|
||||||
|
|
||||||
const [srpAttributes, setSrpAttributes] = useState<SRPAttributes>();
|
const [srpAttributes, setSrpAttributes] = useState<SRPAttributes>();
|
||||||
const [keyAttributes, setKeyAttributes] = useState<KeyAttributes>();
|
const [keyAttributes, setKeyAttributes] = useState<KeyAttributes>();
|
||||||
|
@ -88,7 +90,7 @@ export default function Credentials({ appContext, appName }: PageProps) {
|
||||||
const token = getToken();
|
const token = getToken();
|
||||||
if (key && token) {
|
if (key && token) {
|
||||||
// TODO: Refactor the type of APP_HOMES to not require the ??
|
// TODO: Refactor the type of APP_HOMES to not require the ??
|
||||||
router.push(APP_HOMES.get(appName) ?? "/");
|
router.push(APP_HOMES.get(appNameOld) ?? "/");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const kekEncryptedAttributes: B64EncryptionResult = getKey(
|
const kekEncryptedAttributes: B64EncryptionResult = getKey(
|
||||||
|
@ -248,7 +250,7 @@ export default function Credentials({ appContext, appName }: PageProps) {
|
||||||
}
|
}
|
||||||
const redirectURL = InMemoryStore.get(MS_KEYS.REDIRECT_URL);
|
const redirectURL = InMemoryStore.get(MS_KEYS.REDIRECT_URL);
|
||||||
InMemoryStore.delete(MS_KEYS.REDIRECT_URL);
|
InMemoryStore.delete(MS_KEYS.REDIRECT_URL);
|
||||||
router.push(redirectURL ?? APP_HOMES.get(appName));
|
router.push(redirectURL ?? APP_HOMES.get(appNameOld));
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
log.error("useMasterPassword failed", e);
|
log.error("useMasterPassword failed", e);
|
||||||
}
|
}
|
||||||
|
@ -295,6 +297,8 @@ export default function Credentials({ appContext, appName }: PageProps) {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export default Page;
|
||||||
|
|
||||||
const Header: React.FC<React.PropsWithChildren> = ({ children }) => {
|
const Header: React.FC<React.PropsWithChildren> = ({ children }) => {
|
||||||
return (
|
return (
|
||||||
<Header_>
|
<Header_>
|
||||||
|
|
Loading…
Reference in a new issue