Skip to content

armgit / ente

Public Imported from GitHub
0

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

fix(appLock): handle reauthentication cancellation in app lock settings

Aswin Asokd488c283c54f
diff --git a/web/apps/photos/src/components/Sidebar.tsx b/web/apps/photos/src/components/Sidebar.tsx
index 27e18a4073..84fd2a039e 100644
--- a/web/apps/photos/src/components/Sidebar.tsx
+++ b/web/apps/photos/src/components/Sidebar.tsx
@@ -242,6 +242,14 @@ type FreeUpSpaceAction = Extract<
"freeUpSpace.deduplicate" | "freeUpSpace.largeFiles"
>;
+const appLockReauthenticationCancelledMessage =
+ "app_lock_reauthentication_cancelled";
+
+const isReauthenticationCancellation = (error: unknown) =>
+ error == undefined ||
+ (error instanceof Error &&
+ error.message === appLockReauthenticationCancelledMessage);
+
export const Sidebar: React.FC<SidebarProps> = ({
open,
onClose,
@@ -1156,8 +1164,13 @@ const DesktopAppLockSettings: React.FC<
const { show, props } = useModalVisibility();
const handleOpen = useCallback(async () => {
- await onAuthenticateUser();
- show();
+ try {
+ await onAuthenticateUser();
+ show();
+ } catch (error) {
+ if (isReauthenticationCancellation(error)) return;
+ log.error("Failed to open app lock settings", error);
+ }
}, [onAuthenticateUser, show]);
return (