mirror of
https://github.com/laurent22/joplin.git
synced 2026-06-18 20:16:34 +02:00
Desktop: Improved master password state handling in Encryption screen
This commit is contained in:
1 parent
8d09ed3bac
commit
7d62df8906
3 files changed
+15
-4
No files matched your search
@@ -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