From e1dedc66a2e577e40b198103bf49ca4be81c57b0 Mon Sep 17 00:00:00 2001 From: irismarie Date: Thu, 28 Jan 2021 18:53:04 +0100 Subject: [PATCH] login page based on VillasWeb config --- src/config.js | 5 ++++- src/router.js | 11 +++++++++-- src/styles/app.css | 2 +- src/user/login-select.js | 23 ++--------------------- src/user/logout.js | 13 ++++++++++--- 5 files changed, 26 insertions(+), 28 deletions(-) diff --git a/src/config.js b/src/config.js index 874e58f..75fe3a0 100644 --- a/src/config.js +++ b/src/config.js @@ -22,7 +22,10 @@ const config = { admin: { name: 'Institute for Automation of Complex Power Systems (ACS), RWTH Aachen University, Germany', mail: 'stvogel@eonerc.rwth-aachen.de' - } + }, + externalAuth: true, + loginURL: 'http://localhost:4180/oauth2/start', + provider: 'KeyCloak' }; export default config diff --git a/src/router.js b/src/router.js index 84aa6f7..b0c8dd4 100644 --- a/src/router.js +++ b/src/router.js @@ -29,14 +29,21 @@ import Dashboard from './dashboard/dashboard' import InfrastructureComponents from './ic/ics'; import Users from './user/users'; import User from "./user/user"; +import Config from './config.js'; + class Root extends React.Component { render() { return ( - - + ( + + )} + /> + diff --git a/src/styles/app.css b/src/styles/app.css index 5ca9250..3937b0b 100644 --- a/src/styles/app.css +++ b/src/styles/app.css @@ -225,7 +225,7 @@ body { .login-select { position: sticky; width: 300px; - height: 200px; + height: 150px; top: 50%; left: 50%; margin-top: 50px; diff --git a/src/user/login-select.js b/src/user/login-select.js index d8f6178..e6b8d58 100644 --- a/src/user/login-select.js +++ b/src/user/login-select.js @@ -17,8 +17,6 @@ import React, { Component } from 'react'; import { Form, Button, FormGroup, FormControl, FormLabel, Col } from 'react-bootstrap'; -//import RecoverPassword from './recover-password' -//import AppDispatcher from '../common/app-dispatcher'; import Header from '../common/header'; import Footer from '../common/footer'; import { withRouter } from 'react-router-dom'; @@ -26,27 +24,12 @@ import { withRouter } from 'react-router-dom'; class LoginSelect extends Component { - constructor(props) { - super(props); - - - this.state = { - standardlogin: true, - keycloaklogin: true, - jupyterlogin: false - } - } villaswebLogin = e => { - this.props.history.replace('/login-villas'); + this.props.history.replace('/villaslogin'); } - jupyterLogin() { - - } - - render() { return ( @@ -56,9 +39,7 @@ class LoginSelect extends Component {

- -
- +
diff --git a/src/user/logout.js b/src/user/logout.js index 3179a45..a1e4a4c 100644 --- a/src/user/logout.js +++ b/src/user/logout.js @@ -19,6 +19,7 @@ import React from 'react'; import { Redirect } from 'react-router-dom'; import AppDispatcher from '../common/app-dispatcher'; +import Config from '../config.js'; class Logout extends React.Component { componentDidMount() { @@ -34,9 +35,15 @@ class Logout extends React.Component { } render() { - return ( - - ); + if (Config.externalAuth) { + return ( + + ); + } else { + return ( + + ); + } } }