mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2025-01-12 15:56:00 +08:00
Fix login redirect on from parameter on React login page
This commit is contained in:
parent
4ff06e22e5
commit
cc326ddb84
@ -12,6 +12,7 @@ import drawSine from "../../util/loginSineRenderer";
|
|||||||
import {fetchLogin} from "../../service/authenticationService";
|
import {fetchLogin} from "../../service/authenticationService";
|
||||||
import ForgotPasswordModal from "../../components/modal/ForgotPasswordModal";
|
import ForgotPasswordModal from "../../components/modal/ForgotPasswordModal";
|
||||||
import {useAuth} from "../../hooks/authenticationHook";
|
import {useAuth} from "../../hooks/authenticationHook";
|
||||||
|
import {baseAddress} from "../../service/backendConfiguration";
|
||||||
|
|
||||||
const Logo = () => {
|
const Logo = () => {
|
||||||
return (
|
return (
|
||||||
@ -163,11 +164,11 @@ const LoginPage = () => {
|
|||||||
setFailMessage(t('html.login.failed') + (error.data && error.data.error ? error.data.error : error.message));
|
setFailMessage(t('html.login.failed') + (error.data && error.data.error ? error.data.error : error.message));
|
||||||
}
|
}
|
||||||
} else if (data && data.success) {
|
} else if (data && data.success) {
|
||||||
|
await updateLoginDetails();
|
||||||
if (redirectTo && !redirectTo.startsWith('http') && !redirectTo.startsWith('file') && !redirectTo.startsWith('javascript')) {
|
if (redirectTo && !redirectTo.startsWith('http') && !redirectTo.startsWith('file') && !redirectTo.startsWith('javascript')) {
|
||||||
navigate(redirectTo.substring(redirectTo.indexOf('/')))
|
navigate(baseAddress + redirectTo.substring(redirectTo.indexOf('/')) + (window.location.hash ? window.location.hash : ''));
|
||||||
} else {
|
} else {
|
||||||
await updateLoginDetails();
|
navigate(baseAddress + '/');
|
||||||
navigate('../');
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
setFailMessage(t('html.login.failed') + data ? data.error : t('generic.noData'));
|
setFailMessage(t('html.login.failed') + data ? data.error : t('generic.noData'));
|
||||||
|
Loading…
Reference in New Issue
Block a user