Skip to content

Build your personal knowledge base with Trilium Notes

fix(login): send back 401 Unauthorized on failed login attempt

Panagiotis Papadopoulosfa350e13f6e8
diff --git a/src/routes/login.ts b/src/routes/login.ts
index 3f4d52f321..9387e18fc8 100644
--- a/src/routes/login.ts
+++ b/src/routes/login.ts
@@ -134,7 +134,7 @@ function sendLoginError(req: Request, res: Response, errorType: 'password' | 'to
log.info(`WARNING: Wrong password from ${req.ip}, rejecting.`);
}
- res.render('login', {
+ res.status(401).render('login', {
wrongPassword: errorType === 'password',
wrongTotp: errorType === 'totp',
totpEnabled: totp.isTotpEnabled(),