diff --git a/apps/web/src/dialogs/settings/auth-settings.ts b/apps/web/src/dialogs/settings/auth-settings.ts index 9d09cb11e..79e62c2fd 100644 --- a/apps/web/src/dialogs/settings/auth-settings.ts +++ b/apps/web/src/dialogs/settings/auth-settings.ts @@ -27,6 +27,7 @@ import { RecoveryCodesDialog } from "../mfa/recovery-code-dialog"; import { MultifactorDialog } from "../mfa/multi-factor-dialog"; import { RecoveryKeyDialog } from "../recovery-key-dialog"; import { strings } from "@notesnook/intl"; +import { ConfirmDialog } from "../confirm"; export const AuthenticationSettings: SettingsGroup[] = [ { @@ -45,32 +46,39 @@ export const AuthenticationSettings: SettingsGroup[] = [ title: strings.changePassword(), variant: "secondary", action: async () => { - const result = await showPasswordDialog({ - title: strings.changePassword(), - message: strings.changePasswordDesc(), - inputs: { - oldPassword: { - label: strings.oldPassword(), - autoComplete: "current-password" - }, - newPassword: { - label: strings.newPassword(), - autoComplete: "new-password" - } - }, - validate: async ({ oldPassword, newPassword }) => { - if (!(await createBackup())) return false; - await db.user.clearSessions(); - return ( - (await db.user.changePassword(oldPassword, newPassword)) || - false - ); - } + ConfirmDialog.show({ + title: "Password changing has been disabled temporarily", + message: + "Password changing has been disabled temporarily to address some issues faced by users. It will be enabled again once the issues have resolved.", + positiveButtonText: "Ok" }); - if (result) { - showToast("success", strings.passwordChangedSuccessfully()); - await RecoveryKeyDialog.show({}); - } + return; + // const result = await showPasswordDialog({ + // title: strings.changePassword(), + // message: strings.changePasswordDesc(), + // inputs: { + // oldPassword: { + // label: strings.oldPassword(), + // autoComplete: "current-password" + // }, + // newPassword: { + // label: strings.newPassword(), + // autoComplete: "new-password" + // } + // }, + // validate: async ({ oldPassword, newPassword }) => { + // if (!(await createBackup())) return false; + // await db.user.clearSessions(); + // return ( + // (await db.user.changePassword(oldPassword, newPassword)) || + // false + // ); + // } + // }); + // if (result) { + // showToast("success", strings.passwordChangedSuccessfully()); + // await RecoveryKeyDialog.show({}); + // } } } ] diff --git a/apps/web/src/views/auth.tsx b/apps/web/src/views/auth.tsx index a24d7730a..25ba10d2f 100644 --- a/apps/web/src/views/auth.tsx +++ b/apps/web/src/views/auth.tsx @@ -40,7 +40,7 @@ import AuthContainer from "../components/auth-container"; import { useTimer } from "../hooks/use-timer"; import { ErrorText } from "../components/error-text"; import { AuthenticatorType, User } from "@notesnook/core"; -import { showLogoutConfirmation } from "../dialogs/confirm"; +import { ConfirmDialog, showLogoutConfirmation } from "../dialogs/confirm"; import { TaskManager } from "../common/task-manager"; import { strings } from "@notesnook/intl"; import { ScrollContainer } from "@notesnook/ui"; @@ -339,7 +339,16 @@ function LoginPassword(props: BaseAuthComponentProps<"login:password">) { type="button" mt={2} variant="anchor" - onClick={() => navigate("recover", { email: formData.email })} + onClick={() => { + ConfirmDialog.show({ + title: "Password changing has been disabled temporarily", + message: + "Password changing has been disabled temporarily to address some issues faced by users. It will be enabled again once the issues have resolved.", + positiveButtonText: "Ok" + }); + return; + // navigate("recover", { email: formData.email }) + }} sx={{ color: "paragraph", alignSelf: "end" }} > {strings.forgotPassword()} @@ -499,7 +508,16 @@ function SessionExpiry(props: BaseAuthComponentProps<"sessionExpiry">) { type="button" mt={2} variant="anchor" - onClick={() => user && navigate("recover", { email: user.email })} + onClick={() => { + ConfirmDialog.show({ + title: "Password changing has been disabled temporarily", + message: + "Password changing has been disabled temporarily to address some issues faced by users. It will be enabled again once the issues have resolved.", + positiveButtonText: "Ok" + }); + return; + // user && navigate("recover", { email: user.email }) + }} sx={{ color: "paragraph", alignSelf: "end" }} > {strings.forgotPassword()}