mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-02-01 11:56:48 +01:00
Preserve a query string when redirecting to and from login
This commit is contained in:
parent
f947c1304a
commit
3dcea41c4e
@ -177,9 +177,10 @@ function displayError(message) {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Redirects the user to the home page.
|
* Redirects the user to the home page.
|
||||||
|
* Preserves the query string.
|
||||||
*/
|
*/
|
||||||
function redirectToHome() {
|
function redirectToHome() {
|
||||||
window.location.href = '/';
|
window.location.href = '/' + window.location.search;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -248,7 +248,9 @@ if (!disableCsrf) {
|
|||||||
// Host index page
|
// Host index page
|
||||||
app.get('/', (request, response) => {
|
app.get('/', (request, response) => {
|
||||||
if (userModule.shouldRedirectToLogin(request)) {
|
if (userModule.shouldRedirectToLogin(request)) {
|
||||||
return response.redirect('/login');
|
const query = request.url.split('?')[1];
|
||||||
|
const redirectUrl = query ? `/login?${query}` : '/login';
|
||||||
|
return response.redirect(redirectUrl);
|
||||||
}
|
}
|
||||||
|
|
||||||
return response.sendFile('index.html', { root: path.join(process.cwd(), 'public') });
|
return response.sendFile('index.html', { root: path.join(process.cwd(), 'public') });
|
||||||
|
@ -326,7 +326,7 @@ function toAvatarKey(handle) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initializes the user storage. Currently a no-op.
|
* Initializes the user storage.
|
||||||
* @param {string} dataRoot The root directory for user data
|
* @param {string} dataRoot The root directory for user data
|
||||||
* @returns {Promise<void>}
|
* @returns {Promise<void>}
|
||||||
*/
|
*/
|
||||||
@ -655,6 +655,10 @@ async function createBackupArchive(handle, response) {
|
|||||||
archive.finalize();
|
archive.finalize();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if any admin users are not password protected. If so, logs a warning.
|
||||||
|
* @returns {Promise<void>}
|
||||||
|
*/
|
||||||
async function checkAccountsProtection() {
|
async function checkAccountsProtection() {
|
||||||
if (!ENABLE_ACCOUNTS) {
|
if (!ENABLE_ACCOUNTS) {
|
||||||
return;
|
return;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user