mirror of
https://github.com/streetwriters/notesnook.git
synced 2026-02-23 19:49:56 +01:00
web: temporarily disable change&forgot password
Signed-off-by: 01zulfi <85733202+01zulfi@users.noreply.github.com>
This commit is contained in:
@@ -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({});
|
||||
// }
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
@@ -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()}
|
||||
|
||||
Reference in New Issue
Block a user