[bug] Don't try per user auto-login if basic auth disabled
| @@ -363,7 +363,7 @@ app.get('/login', async (request, response) => { | ||
| 363 | 363 | } |
| 364 | 364 | |
| 365 | 365 | try { |
| 366 | 366 | const autoLogin = await userModule.tryAutoLogin(request, basicAuthMode); |
| 367 | 367 | |
| 368 | 368 | if (autoLogin) { |
| 369 | 369 | return response.redirect('/'); |
| @@ -571,9 +571,10 @@ function shouldRedirectToLogin(request) { | ||
| 571 | 571 | * Tries auto-login if there is only one user and it's not password protected. |
| 572 | 572 | * or another configured method such authlia or basic |
| 573 | 573 | * @param {import('express').Request} request Request object |
| 574 | + * @param {boolean} basicAuthMode If Basic auth mode is enabled | |
| 574 | 575 | * @returns {Promise<boolean>} Whether auto-login was performed |
| 575 | 576 | */ |
| 576 | 577 | async function tryAutoLogin(request, basicAuthMode) { |
| 577 | 578 | if (!ENABLE_ACCOUNTS || request.user || !request.session) { |
| 578 | 579 | return false; |
| 579 | 580 | } |
| @@ -587,7 +588,7 @@ async function tryAutoLogin(request) { | ||
| 587 | 588 | return true; |
| 588 | 589 | } |
| 589 | 590 | |
| 590 | 591 | if (basicAuthMode && PER_USER_BASIC_AUTH && await basicUserLogin(request)) { |
| 591 | 592 | return true; |
| 592 | 593 | } |
| 593 | 594 | } |