Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

fix(photos):guard-two-factor-actions-with-fresh-status

Aswin Asoke9241ed6c4fc
diff --git a/web/apps/photos/src/components/sidebar/accounts/Account.tsx b/web/apps/photos/src/components/sidebar/accounts/Account.tsx
index 823cbb819c..bd17f95f43 100644
--- a/web/apps/photos/src/components/sidebar/accounts/Account.tsx
+++ b/web/apps/photos/src/components/sidebar/accounts/Account.tsx
@@ -117,6 +117,7 @@ export const Account: React.FC<AccountProps> = ({
useModalVisibility();
useEffect(() => {
+ setTwoFactorEnabled(undefined);
if (!open || sessionsVisibilityProps.open) return;
let cancelled = false;
void Promise.all([
@@ -244,6 +245,11 @@ export const Account: React.FC<AccountProps> = ({
]);
const handleReconfigureTwoFactor = useCallback(() => {
+ if (twoFactorEnabled === undefined) return;
+ if (!twoFactorEnabled) {
+ configureTwoFactor();
+ return;
+ }
showMiniDialog({
title: t("update_two_factor"),
message: t("update_two_factor_message"),
@@ -253,12 +259,13 @@ export const Account: React.FC<AccountProps> = ({
action: configureTwoFactor,
},
});
- }, [configureTwoFactor, showMiniDialog]);
+ }, [twoFactorEnabled, configureTwoFactor, showMiniDialog]);
useEffect(() => {
if (!open || !pendingAction) return;
if (
- pendingAction == "account.twoFactor" &&
+ (pendingAction == "account.twoFactor" ||
+ pendingAction == "account.twoFactor.reconfigure") &&
twoFactorEnabled === undefined
)
return;
@@ -342,10 +349,12 @@ export const Account: React.FC<AccountProps> = ({
}
/>
{twoFactorEnabled && (
- <RowCard
- title={t("update_two_factor")}
- onClick={handleReconfigureTwoFactor}
- />
+ <Stack sx={{ pl: 2 }}>
+ <RowCard
+ title={t("update_two_factor")}
+ onClick={handleReconfigureTwoFactor}
+ />
+ </Stack>
)}
<RowCard title={t("passkeys")} onClick={handlePasskeys} />
<RowCard