You've already forked joplin
mirror of
https://github.com/laurent22/joplin.git
synced 2025-06-27 23:28:38 +02:00
Desktop: Improved master password state handling in Encryption screen
This commit is contained in:
@ -188,6 +188,16 @@ export const usePasswordChecker = (masterKeys: MasterKeyEntity[], activeMasterKe
|
||||
return { passwordChecks, masterPasswordKeys, masterPasswordStatus };
|
||||
};
|
||||
|
||||
export const useNeedMasterPassword = (passwordChecks: PasswordChecks, masterKeys: MasterKeyEntity[]) => {
|
||||
for (const [mkId, valid] of Object.entries(passwordChecks)) {
|
||||
const mk = masterKeys.find(mk => mk.id === mkId);
|
||||
if (!mk) continue;
|
||||
if (!masterKeyEnabled(mk)) continue;
|
||||
if (!valid) return true;
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
export const upgradeMasterKey = async (masterKey: MasterKeyEntity, passwordChecks: PasswordChecks, passwords: Record<string, string>): Promise<string> => {
|
||||
const passwordCheck = passwordChecks[masterKey.id];
|
||||
if (!passwordCheck) {
|
||||
|
Reference in New Issue
Block a user