diff --git a/packages/app-desktop/gui/EncryptionConfigScreen/EncryptionConfigScreen.tsx b/packages/app-desktop/gui/EncryptionConfigScreen/EncryptionConfigScreen.tsx index d672266dd..a4a936e7a 100644 --- a/packages/app-desktop/gui/EncryptionConfigScreen/EncryptionConfigScreen.tsx +++ b/packages/app-desktop/gui/EncryptionConfigScreen/EncryptionConfigScreen.tsx @@ -268,7 +268,7 @@ const EncryptionConfigScreen = (props: Props) => { const buttonTitle = CommandService.instance().label('openMasterPasswordDialog'); const needPasswordMessage = !needMasterPassword ? null : ( -

{_('Your master password is needed to decrypt some of your data.')}
{_('Please click on "%s" to proceed', buttonTitle)}

+

{_('Your password is needed to decrypt some of your data.')}
{_('Please click on "%s" to proceed, or set the passwords in the "%s" list below.', buttonTitle, _('Encryption keys'))}

); return ( diff --git a/packages/app-desktop/gui/EncryptionConfigScreen/style.scss b/packages/app-desktop/gui/EncryptionConfigScreen/style.scss index b1a7536f0..75392d089 100644 --- a/packages/app-desktop/gui/EncryptionConfigScreen/style.scss +++ b/packages/app-desktop/gui/EncryptionConfigScreen/style.scss @@ -5,6 +5,7 @@ .manage-password-section > .status { display: flex; flex-direction: row; + align-items: center; } .manage-password-section > .needpassword { diff --git a/packages/app-desktop/gui/MasterPasswordDialog/Dialog.tsx b/packages/app-desktop/gui/MasterPasswordDialog/Dialog.tsx index ee12fe20a..7fd376c2b 100644 --- a/packages/app-desktop/gui/MasterPasswordDialog/Dialog.tsx +++ b/packages/app-desktop/gui/MasterPasswordDialog/Dialog.tsx @@ -34,6 +34,12 @@ export default function(props: Props) { const [updatingPassword, setUpdatingPassword] = useState(false); const [mode, setMode] = useState(Mode.Set); + const showCurrentPassword = useMemo(() => { + if ([MasterPasswordStatus.NotSet, MasterPasswordStatus.Invalid].includes(status)) return false; + if (mode === Mode.Reset) return false; + return true; + }, [status]); + const onClose = useCallback(() => { props.dispatch({ type: 'DIALOG_CLOSE', @@ -63,7 +69,7 @@ export default function(props: Props) { setUpdatingPassword(true); try { if (mode === Mode.Set) { - await updateMasterPassword(currentPassword, password1); + await updateMasterPassword(showCurrentPassword ? currentPassword : null, password1); } else if (mode === Mode.Reset) { await resetMasterPassword(EncryptionService.instance(), KvStore.instance(), ShareService.instance(), password1); } else { @@ -115,7 +121,7 @@ export default function(props: Props) { }, [password1, password2, updatingPassword, needToRepeatPassword]); useEffect(() => { - setShowPasswordForm(status === MasterPasswordStatus.NotSet); + setShowPasswordForm([MasterPasswordStatus.NotSet, MasterPasswordStatus.Invalid].includes(status)); }, [status]); useAsyncEffect(async (event: AsyncEffectEvent) => { @@ -131,8 +137,7 @@ export default function(props: Props) { function renderPasswordForm() { const renderCurrentPassword = () => { - if (status === MasterPasswordStatus.NotSet) return null; - if (mode === Mode.Reset) return null; + if (!showCurrentPassword) return null; // If the master password is in the keychain we preload it into the // field and allow displaying it. That way if the user has forgotten diff --git a/packages/app-desktop/main.scss b/packages/app-desktop/main.scss index 9b3794345..3c199ab58 100644 --- a/packages/app-desktop/main.scss +++ b/packages/app-desktop/main.scss @@ -275,4 +275,5 @@ Component-specific classes .master-password-dialog .fa-times { color: var(--joplin-color-error); + margin-left: 5px; }