appPassword: add expiry
This commit is contained in:
+2
-1
@@ -619,7 +619,8 @@ async function verifyAppPassword(userId, password, identifier) {
|
||||
|
||||
const results = await appPasswords.list(userId);
|
||||
|
||||
const hashedPasswords = results.filter(r => r.identifier === identifier).map(r => r.hashedPassword);
|
||||
const now = new Date();
|
||||
const hashedPasswords = results.filter(r => r.identifier === identifier).filter(r => !r.expiresAt || new Date(r.expiresAt) > now).map(r => r.hashedPassword);
|
||||
const hash = crypto.createHash('sha256').update(password).digest('base64');
|
||||
|
||||
if (hashedPasswords.includes(hash)) return;
|
||||
|
||||
Reference in New Issue
Block a user