mirror of
https://github.com/ente-io/ente.git
synced 2025-08-08 07:28:26 +00:00
Update
This commit is contained in:
parent
73ea3d167d
commit
70f40aa103
@ -1,4 +1,3 @@
|
||||
import { disableTwoFactor } from "@/accounts/api/user";
|
||||
import { MenuItemGroup, MenuSectionTitle } from "@/base/components/Menu";
|
||||
import { FocusVisibleButton } from "@/base/components/mui/FocusVisibleButton";
|
||||
import {
|
||||
@ -6,6 +5,7 @@ import {
|
||||
SidebarDrawerTitlebar,
|
||||
type NestedSidebarDrawerVisibilityProps,
|
||||
} from "@/base/components/mui/SidebarDrawer";
|
||||
import { disable2FA } from "@/new/photos/services/user";
|
||||
import { useAppContext } from "@/new/photos/types/context";
|
||||
import { EnteMenuItem } from "@ente/shared/components/Menu/EnteMenuItem";
|
||||
import { PHOTOS_PAGES as PAGES } from "@ente/shared/constants/pages";
|
||||
@ -118,7 +118,7 @@ const ManageDrawerContents: React.FC<ContentsProps> = ({ onRootClose }) => {
|
||||
});
|
||||
|
||||
const disable = async () => {
|
||||
await disableTwoFactor();
|
||||
await disable2FA();
|
||||
await setLSUser({
|
||||
...getData(LS_KEYS.USER),
|
||||
isTwoFactorEnabled: false,
|
||||
|
@ -176,14 +176,3 @@ export const setRecoveryKey = async (token: string, recoveryKey: RecoveryKey) =>
|
||||
"X-Auth-Token": token,
|
||||
},
|
||||
);
|
||||
|
||||
export const disableTwoFactor = async () => {
|
||||
await HTTPService.post(
|
||||
await apiURL("/users/two-factor/disable"),
|
||||
null,
|
||||
undefined,
|
||||
{
|
||||
"X-Auth-Token": getToken(),
|
||||
},
|
||||
);
|
||||
};
|
||||
|
@ -1,3 +1,6 @@
|
||||
import { authenticatedRequestHeaders, ensureOk } from "@/base/http";
|
||||
import { apiURL } from "@/base/origins";
|
||||
|
||||
export interface FamilyMember {
|
||||
email: string;
|
||||
usage: number;
|
||||
@ -10,3 +13,14 @@ export interface FamilyData {
|
||||
expiry: number;
|
||||
members: FamilyMember[];
|
||||
}
|
||||
|
||||
/**
|
||||
* Disable two-factor authentication for the current user on remote.
|
||||
*/
|
||||
export const disable2FA = async () =>
|
||||
ensureOk(
|
||||
await fetch(await apiURL("/users/two-factor/disable"), {
|
||||
method: "POST",
|
||||
headers: await authenticatedRequestHeaders(),
|
||||
}),
|
||||
);
|
||||
|
Loading…
x
Reference in New Issue
Block a user