mirror of
https://github.com/ente-io/ente.git
synced 2025-08-08 07:28:26 +00:00
Extract
This commit is contained in:
parent
cafead44d4
commit
7356522c6f
@ -31,6 +31,7 @@ import { PAGES } from "../constants/pages";
|
||||
import { configureSRP } from "../services/srp";
|
||||
import type { PageProps } from "../types/page";
|
||||
import type { SRPSetupAttributes } from "../types/srp";
|
||||
import { redirectUserToPasskeyVerificationFlow } from "../services/passkey";
|
||||
|
||||
const Page: React.FC<PageProps> = ({ appContext }) => {
|
||||
const { appName, logout } = appContext;
|
||||
@ -85,9 +86,7 @@ const Page: React.FC<PageProps> = ({ appContext }) => {
|
||||
isTwoFactorPasskeysEnabled: true,
|
||||
});
|
||||
setIsFirstLogin(true);
|
||||
window.location.href = `${accountsAppURL()}/passkeys/verify?passkeySessionID=${passkeySessionID}&redirect=${
|
||||
window.location.origin
|
||||
}/passkeys/finish`;
|
||||
redirectUserToPasskeyVerificationFlow(passkeySessionID);
|
||||
router.push(PAGES.CREDENTIALS);
|
||||
} else if (twoFactorSessionID) {
|
||||
setData(LS_KEYS.USER, {
|
||||
|
@ -1,9 +1,27 @@
|
||||
import log from "@/next/log";
|
||||
import { CustomError } from "@ente/shared/error";
|
||||
import HTTPService from "@ente/shared/network/HTTPService";
|
||||
import { getEndpoint } from "@ente/shared/network/api";
|
||||
import { accountsAppURL, getEndpoint } from "@ente/shared/network/api";
|
||||
import { getToken } from "@ente/shared/storage/localStorage/helpers";
|
||||
|
||||
/**
|
||||
* Redirect user to accounts.ente.io (or its equivalent), to a page where they
|
||||
* can authenticate using their second factor, a passkey they've configured.
|
||||
*
|
||||
* On successful verification, accounts.ente.io will redirect back to our
|
||||
* `/passkeys/finish` page.
|
||||
*
|
||||
* @param passkeySessionID An identifier provided by museum for this passkey
|
||||
* verification session.
|
||||
*/
|
||||
export const redirectUserToPasskeyVerificationFlow = (
|
||||
passkeySessionID: string,
|
||||
) => {
|
||||
const redirect = `${window.location.origin}/passkeys/finish`;
|
||||
const params = new URLSearchParams({ passkeySessionID, redirect });
|
||||
window.location.href = `${accountsAppURL()}/passkeys/verify?${params.toString()}`;
|
||||
};
|
||||
|
||||
export const isPasskeyRecoveryEnabled = async () => {
|
||||
try {
|
||||
const token = getToken();
|
||||
|
Loading…
x
Reference in New Issue
Block a user