mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
[bug] Don't try per user auto-login if basic auth disabled
This commit is contained in:
@ -363,7 +363,7 @@ app.get('/login', async (request, response) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const autoLogin = await userModule.tryAutoLogin(request);
|
const autoLogin = await userModule.tryAutoLogin(request, basicAuthMode);
|
||||||
|
|
||||||
if (autoLogin) {
|
if (autoLogin) {
|
||||||
return response.redirect('/');
|
return response.redirect('/');
|
||||||
|
@ -571,9 +571,10 @@ function shouldRedirectToLogin(request) {
|
|||||||
* Tries auto-login if there is only one user and it's not password protected.
|
* Tries auto-login if there is only one user and it's not password protected.
|
||||||
* or another configured method such authlia or basic
|
* or another configured method such authlia or basic
|
||||||
* @param {import('express').Request} request Request object
|
* @param {import('express').Request} request Request object
|
||||||
|
* @param {boolean} basicAuthMode If Basic auth mode is enabled
|
||||||
* @returns {Promise<boolean>} Whether auto-login was performed
|
* @returns {Promise<boolean>} Whether auto-login was performed
|
||||||
*/
|
*/
|
||||||
async function tryAutoLogin(request) {
|
async function tryAutoLogin(request, basicAuthMode) {
|
||||||
if (!ENABLE_ACCOUNTS || request.user || !request.session) {
|
if (!ENABLE_ACCOUNTS || request.user || !request.session) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -587,7 +588,7 @@ async function tryAutoLogin(request) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (PER_USER_BASIC_AUTH && await basicUserLogin(request)) {
|
if (basicAuthMode && PER_USER_BASIC_AUTH && await basicUserLogin(request)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user