web: enable password changing

This commit is contained in:
Abdullah Atta
2026-02-09 11:08:00 +05:00
parent 8c766ef4f0
commit 16b6b37b94
2 changed files with 32 additions and 34 deletions

View File

@@ -38,7 +38,7 @@ type RecoveryKeyDialogProps = BaseDialogProps<false>;
export const RecoveryKeyDialog = DialogManager.register(
function RecoveryKeyDialog(props: RecoveryKeyDialogProps) {
const key = usePromise(() =>
db.user.getEncryptionKey().then((key) => key?.key)
db.user.getMasterKey().then((key) => key?.key)
);
const [copyText, setCopyText] = useState("Copy to clipboard");

View File

@@ -27,7 +27,6 @@ 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[] = [
{
@@ -46,39 +45,38 @@ export const AuthenticationSettings: SettingsGroup[] = [
title: strings.changePassword(),
variant: "secondary",
action: async () => {
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"
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 }) => {
try {
if (!(await createBackup({ noVerify: true }))) return false;
return (
(await db.user.changePassword(
oldPassword,
newPassword
)) || false
);
} catch (e) {
console.error(e);
return false;
}
}
});
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({});
// }
if (result) {
showToast("success", strings.passwordChangedSuccessfully());
await RecoveryKeyDialog.show({});
}
}
}
]