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
monograph: show error message for empty password on unlock (#9927)
01zulfie3816234ff18
diff --git a/apps/monograph/app/components/monographpost/index.tsx b/apps/monograph/app/components/monographpost/index.tsxindex 2c3790f0b..22499c7fc 100644--- a/apps/monograph/app/components/monographpost/index.tsx+++ b/apps/monograph/app/components/monographpost/index.tsx@@ -387,10 +387,14 @@ function MonographLockscreen({}) {const [error, setError] = useState<string>();const [loading, setLoading] = useState<boolean>();- const password = useRef<string>();+ const password = useRef<string>("");const unlock = useCallback(async () => {- if (!password.current) return;+ if (!password.current) {+ setError("Password is required.");+ return;+ }+setError(undefined);setLoading(true);try {@@ -470,7 +474,9 @@ function MonographLockscreen({}}autoFocus={true}autofillBackgroundColor="background-secondary"- onChange={(event) => (password.current = event.target.value)}+ onChange={(event) => {+ password.current = event.target.value;+ }}onKeyUp={(e) => (e.key === "Enter" ? unlock() : null)}type="password"placeholder="Enter password to continue"@@ -480,6 +486,7 @@ function MonographLockscreen({title="Unlock"sx={{ borderRadius: 100, px: 50, mt: 1 }}onClick={() => unlock()}+ disabled={loading}>Unlock</Button>