Skip to content

armgit / ente

Public Imported from GitHub
0

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

Update message

Manav Rathi1cd5536eb125
diff --git a/web/apps/photos/src/components/AuthenticateUserModal.tsx b/web/apps/photos/src/components/AuthenticateUserModal.tsx
index 57df7a489f..592291b310 100644
--- a/web/apps/photos/src/components/AuthenticateUserModal.tsx
+++ b/web/apps/photos/src/components/AuthenticateUserModal.tsx
@@ -1,7 +1,7 @@
import log from "@/next/log";
import { checkSessionValidity } from "@ente/accounts/services/session";
import DialogBoxV2 from "@ente/shared/components/DialogBoxV2";
-import { dismissableSessionExpiredDialogAttributes } from "@ente/shared/components/LoginComponents";
+import type { DialogBoxAttributesV2 } from "@ente/shared/components/DialogBoxV2/types";
import VerifyMasterPasswordForm, {
type VerifyMasterPasswordFormProps,
} from "@ente/shared/components/VerifyMasterPasswordForm";
@@ -34,18 +34,18 @@ export default function AuthenticateUserModal({
content: t("UNKNOWN_ERROR"),
});
- // This is a altered version of the check we do on the password
- // verification screen, except here it don't try to overwrite local
- // state and instead just request the user to login again if we detect
- // that their password has changed on a different device and they
- // haven't unlocked even once since then on this device.
+ // This is a altered version of the check we do on the password verification
+ // screen, except here it don't try to overwrite local state and instead
+ // just request the user to login again if we detect that their password has
+ // changed on a different device and they haven't unlocked even once since
+ // then on this device.
const validateSession = useCallback(async () => {
try {
const session = await checkSessionValidity();
if (session.status != "valid") {
onClose();
setDialogBoxAttributesV2(
- dismissableSessionExpiredDialogAttributes(logout),
+ passwordChangedElsewhereDialogAttributes(logout),
);
}
} catch (e) {
@@ -114,3 +114,23 @@ export default function AuthenticateUserModal({
</DialogBoxV2>
);
}
+
+/**
+ * Attributes for a dialog box that informs the user that their password was
+ * changed on a different device, and they the need to login again to be able to
+ * use the new one. Cancellable.
+ *
+ * @param onLogin Called if the user chooses the login option.
+ */
+const passwordChangedElsewhereDialogAttributes = (
+ onLogin: () => void,
+): DialogBoxAttributesV2 => ({
+ title: t("password_changed_elsewhere"),
+ content: t("password_changed_elsewhere_message"),
+ proceed: {
+ text: t("LOGIN"),
+ action: onLogin,
+ variant: "accent",
+ },
+ close: { text: t("CANCEL") },
+});
diff --git a/web/packages/next/locales/en-US/translation.json b/web/packages/next/locales/en-US/translation.json
index 6b7313972c..323c32b20f 100644
--- a/web/packages/next/locales/en-US/translation.json
+++ b/web/packages/next/locales/en-US/translation.json
@@ -107,6 +107,8 @@
"SESSION_EXPIRED": "Session expired",
"PASSWORD_GENERATION_FAILED": "Your browser was unable to generate a strong key that meets Ente's encryption standards, please try using the mobile app or another browser",
"CHANGE_PASSWORD": "Change password",
+ "password_changed_elsewhere": "Password changed elsewhere",
+ "password_changed_elsewhere_message": "Please login again on this device to use your new password to authenticate.",
"GO_BACK": "Go back",
"RECOVERY_KEY": "Recovery key",
"SAVE_LATER": "Do this later",
diff --git a/web/packages/shared/components/LoginComponents.tsx b/web/packages/shared/components/LoginComponents.tsx
index 0246189cac..8201ccacc9 100644
--- a/web/packages/shared/components/LoginComponents.tsx
+++ b/web/packages/shared/components/LoginComponents.tsx
@@ -222,21 +222,3 @@ export const sessionExpiredDialogAttributes = (
variant: "accent",
},
});
-
-/**
- * A variant of {@link sessionExpiredDialogAttributes} that allows the user to
- * close it. This would allow them to, say, view their recovery key if they wish
- * instead of being forced to immediately logout.
- */
-export const dismissableSessionExpiredDialogAttributes = (
- onLogin: () => void,
-): DialogBoxAttributesV2 => ({
- title: t("SESSION_EXPIRED"),
- content: t("SESSION_EXPIRED_MESSAGE"),
- proceed: {
- text: t("LOGIN"),
- action: onLogin,
- variant: "accent",
- },
- close: { text: t("CANCEL") },
-});