mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2024-11-25 11:16:31 -05:00
Redirect logged-in users from /login to /history
This commit is contained in:
parent
0071c81699
commit
f5a851814a
1 changed files with 10 additions and 0 deletions
|
@ -9,11 +9,14 @@ import {ApplicationState} from "../../../../redux";
|
||||||
import {ViaOpenId} from "./auth/via-open id";
|
import {ViaOpenId} from "./auth/via-open id";
|
||||||
import "./login.scss";
|
import "./login.scss";
|
||||||
import {ElementSeparator} from "../../../element-separator/element-separator";
|
import {ElementSeparator} from "../../../element-separator/element-separator";
|
||||||
|
import {Redirect} from "react-router";
|
||||||
|
import {LoginStatus} from "../../../../redux/user/types";
|
||||||
|
|
||||||
const Login: React.FC = () => {
|
const Login: React.FC = () => {
|
||||||
useTranslation();
|
useTranslation();
|
||||||
const authProviders = useSelector((state: ApplicationState) => state.backendConfig.authProviders);
|
const authProviders = useSelector((state: ApplicationState) => state.backendConfig.authProviders);
|
||||||
const customAuthNames = useSelector((state: ApplicationState) => state.backendConfig.customAuthNames);
|
const customAuthNames = useSelector((state: ApplicationState) => state.backendConfig.customAuthNames);
|
||||||
|
const userLoginState = useSelector((state: ApplicationState) => state.user.status);
|
||||||
const emailForm = authProviders.email ? <ViaEMail/> : null
|
const emailForm = authProviders.email ? <ViaEMail/> : null
|
||||||
const ldapForm = authProviders.ldap ? <ViaLdap/> : null
|
const ldapForm = authProviders.ldap ? <ViaLdap/> : null
|
||||||
const openIdForm = authProviders.openid ? <ViaOpenId/> : null
|
const openIdForm = authProviders.openid ? <ViaOpenId/> : null
|
||||||
|
@ -29,6 +32,13 @@ const Login: React.FC = () => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (userLoginState === LoginStatus.ok) {
|
||||||
|
// TODO Redirect to previous page?
|
||||||
|
return (
|
||||||
|
<Redirect to='/history' />
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Jumbotron className="bg-dark">
|
<Jumbotron className="bg-dark">
|
||||||
<div className="my-3">
|
<div className="my-3">
|
||||||
|
|
Loading…
Reference in a new issue