fix types

This commit is contained in:
Andrea Vos 2024-12-31 11:35:12 +01:00
parent 1055e3b5bd
commit 6d8dbbb617

View File

@ -106,7 +106,7 @@ export const saveAuthenticator = async (
payload,
});
}
await auditLog({ db, user }, 'auth/saved_authenticator', {
await auditLog({ user }, 'auth/saved_authenticator', {
type,
payloadId: payload.id || undefined,
name: payload.name || undefined,
@ -478,7 +478,7 @@ router.post('/user/init', handleErrorAsync(async (req, res) => {
if (user) {
const { block } = await fetchLoginAttempts(req.db, user.id);
if (block) {
await auditLog({ db: req.db, user }, 'auth/login_too_many_attempts');
await auditLog({ user }, 'auth/login_too_many_attempts');
return res.json({ error: 'user.tooManyAttempts' });
}
}
@ -490,12 +490,12 @@ router.post('/user/init', handleErrorAsync(async (req, res) => {
};
if (!await validateEmail(payload.email)) {
await auditLog({ db: req.db, user }, 'auth/email_invalid', { email: payload.email });
await auditLog({ user }, 'auth/email_invalid', { email: payload.email });
return res.json({ error: 'user.account.changeEmail.invalid' });
}
if (!user && await lookupBanArchive(req.db, 'email', payload)) {
await auditLog({ db: req.db, user }, 'auth/blocked_archive_ban');
await auditLog({ user }, 'auth/blocked_archive_ban');
return res.status(401).json({ error: 'Unauthorised' });
}
@ -511,12 +511,12 @@ router.post('/user/init', handleErrorAsync(async (req, res) => {
mailer(payload.email, 'confirmCode', { code: payload.code });
await auditLog({ db: req.db, user }, 'auth/requested_email_code', { email: payload.email });
await auditLog({ user }, 'auth/requested_email_code', { email: payload.email });
},
async () => {
const auth = await findLatestEmailAuthenticator(req.db, payload.email, 'email');
codeKey = auth ? auth.id : null;
await auditLog({ db: req.db, user }, 'auth/requested_email_code_duplicate', { email: payload.email });
await auditLog({ user }, 'auth/requested_email_code_duplicate', { email: payload.email });
},
);
}