mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
Add a noauto query param to login
This commit is contained in:
@ -180,7 +180,13 @@ function displayError(message) {
|
|||||||
* Preserves the query string.
|
* Preserves the query string.
|
||||||
*/
|
*/
|
||||||
function redirectToHome() {
|
function redirectToHome() {
|
||||||
window.location.href = '/' + window.location.search;
|
// After a login theres no need to preserve the
|
||||||
|
// noauto (if present)
|
||||||
|
const urlParams = new URLSearchParams(window.location.search);
|
||||||
|
|
||||||
|
urlParams.delete('noauto');
|
||||||
|
|
||||||
|
window.location.href = '/' + urlParams.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -848,7 +848,14 @@ async function logout() {
|
|||||||
headers: getRequestHeaders(),
|
headers: getRequestHeaders(),
|
||||||
});
|
});
|
||||||
|
|
||||||
window.location.reload();
|
// On an explicit logout stop auto login
|
||||||
|
// to allow user to change username even
|
||||||
|
// when auto auth (such as authelia or basic)
|
||||||
|
// would be valid
|
||||||
|
const urlParams = new URLSearchParams(window.location.search);
|
||||||
|
urlParams.set('noauto', 'true');
|
||||||
|
|
||||||
|
window.location.search = urlParams.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
20
src/users.js
20
src/users.js
@ -569,6 +569,7 @@ 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
|
||||||
* @param {import('express').Request} request Request object
|
* @param {import('express').Request} request Request object
|
||||||
* @returns {Promise<boolean>} Whether auto-login was performed
|
* @returns {Promise<boolean>} Whether auto-login was performed
|
||||||
*/
|
*/
|
||||||
@ -577,16 +578,19 @@ async function tryAutoLogin(request) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (await singleUserLogin(request)) {
|
console.warn(request.session.noauto);
|
||||||
return true;
|
if (!request.query.noauto) {
|
||||||
}
|
if (await singleUserLogin(request)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
if (AUTHELIA_AUTH && await autheliaUserLogin(request)) {
|
if (AUTHELIA_AUTH && await autheliaUserLogin(request)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (PERUSER_BASIC_AUTH && await basicUserLogin(request)) {
|
if (PERUSER_BASIC_AUTH && await basicUserLogin(request)) {
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
Reference in New Issue
Block a user