mirror of
https://github.com/open-webui/open-webui.git
synced 2025-12-13 04:45:19 +00:00
Add redirect capability
This feature allows the authentication process to redirect to a route passed in the querystring. This allows the /auth route a means of bringing the user to an expected route instead of the main page (root).
This commit is contained in:
parent
3f3a5bb0ab
commit
7837843f82
1 changed files with 9 additions and 1 deletions
|
|
@ -28,6 +28,12 @@
|
|||
|
||||
let ldapUsername = '';
|
||||
|
||||
const querystringValue = (key) => {
|
||||
const querystring = window.location.search;
|
||||
const urlParams = new URLSearchParams(querystring);
|
||||
return urlParams.get(key);
|
||||
};
|
||||
|
||||
const setSessionUser = async (sessionUser) => {
|
||||
if (sessionUser) {
|
||||
console.log(sessionUser);
|
||||
|
|
@ -39,7 +45,9 @@
|
|||
$socket.emit('user-join', { auth: { token: sessionUser.token } });
|
||||
await user.set(sessionUser);
|
||||
await config.set(await getBackendConfig());
|
||||
goto('/');
|
||||
|
||||
const redirectPath = querystringValue('redirect') || '/';
|
||||
goto(redirectPath);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue