mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-08-28 11:39:21 +03:00
Remove remembered passphrase after 15 minutes of inactivity
https://github.com/the-djmaze/snappymail/issues/1142#issuecomment-1635839009
This commit is contained in:
parent
9bc56a5abd
commit
190db75c19
5 changed files with 16 additions and 5 deletions
|
|
@ -4,5 +4,16 @@ export const Passphrases = new WeakMap();
|
|||
|
||||
Passphrases.ask = async (key, sAskDesc, btnText) =>
|
||||
Passphrases.has(key)
|
||||
? {password:Passphrases.get(key)/*, remember:false*/}
|
||||
? {password:Passphrases.handle(key)/*, remember:false*/}
|
||||
: await AskPopupView.password(sAskDesc, btnText);
|
||||
|
||||
const timeouts = {};
|
||||
// get/set accessor to control deletion after 15 minutes of inactivity
|
||||
Passphrases.handle = (key, pass) => {
|
||||
if (!timeouts[key]) {
|
||||
timeouts[key] = (()=>Passphrases.delete(key)).debounce(900000);
|
||||
}
|
||||
pass && Passphrases.set(key, pass);
|
||||
timeouts[key]();
|
||||
return Passphrases.get(key);
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue