A fully open source & end-to-end encrypted note taking alternative to Evernote.
TypeScript asp-net-coredotnet-coreelectronfosshacktoberfestnote-managmentnote-takingnote-taking-appnotebooknotesnotes-appopen-sourceopensourceprivacyproductivityreactreact-nativereactjsself-hosted
web: add missing change password logic
Abdullah Atta36a99cd64fc2
diff --git a/apps/web/src/common/dialog-controller.tsx b/apps/web/src/common/dialog-controller.tsxindex 58012443c..9777ac536 100644--- a/apps/web/src/common/dialog-controller.tsx+++ b/apps/web/src/common/dialog-controller.tsx@@ -430,7 +430,13 @@ function getDialogData(type: string) {export function showPasswordDialog(type: string,- validate: ({ password }: { password: string }) => boolean | Promise<boolean>+ validate: ({+ password+ }: {+ password?: string;+ oldPassword?: string;+ newPassword?: string;+ }) => boolean | Promise<boolean>) {const { title, subtitle, positiveButtonText, checks } = getDialogData(type);return showDialog("PasswordDialog", (Dialog, perform) => (diff --git a/apps/web/src/dialogs/settings/auth-settings.ts b/apps/web/src/dialogs/settings/auth-settings.tsindex 8a9ec7d29..7acab46a7 100644--- a/apps/web/src/dialogs/settings/auth-settings.ts+++ b/apps/web/src/dialogs/settings/auth-settings.ts@@ -22,8 +22,11 @@ import { useStore as useUserStore } from "../../stores/user-store";import { verifyAccount } from "../../common";import {show2FARecoveryCodesDialog,- showMultifactorDialog+ showMultifactorDialog,+ showPasswordDialog} from "../../common/dialog-controller";+import { db } from "../../common/db";+import { showToast } from "../../utils/toast";export const AuthenticationSettings: SettingsGroup[] = [{@@ -41,7 +44,21 @@ export const AuthenticationSettings: SettingsGroup[] = [type: "button",title: "Change password",variant: "secondary",- action: () => {}+ action: async () => {+ const result = await showPasswordDialog(+ "change_account_password",+ async (data) => {+ await db.user?.clearSessions();+ return (+ db.user?.changePassword(+ data.oldPassword,+ data.newPassword+ ) || false+ );+ }+ );+ if (result) showToast("success", "Account password changed!");+ }}]}