From 329ae35c7f2b09dcb42ca0238341858cc01898f2 Mon Sep 17 00:00:00 2001 From: Steve Hu Date: Sat, 28 Mar 2020 11:34:12 -0400 Subject: [PATCH] fixes #242 add a link to the login error message to access API directly --- login-view/src/components/ErrorMessage.js | 8 +++++--- login-view/src/components/Login.js | 15 ++++++++++++++- login-view/src/setupProxy.js | 1 + 3 files changed, 20 insertions(+), 4 deletions(-) diff --git a/login-view/src/components/ErrorMessage.js b/login-view/src/components/ErrorMessage.js index 427e69a0..89e5f3c9 100644 --- a/login-view/src/components/ErrorMessage.js +++ b/login-view/src/components/ErrorMessage.js @@ -10,10 +10,12 @@ const useStyles = makeStyles(theme => ({ function ErrorMessage(props) { const classes = useStyles(); return ( -
- {props.error} -
+
) } +function createMarkup(error) { + return {__html: error}; +} + export default ErrorMessage; diff --git a/login-view/src/components/Login.js b/login-view/src/components/Login.js index b4c61dd9..3cf1d461 100644 --- a/login-view/src/components/Login.js +++ b/login-view/src/components/Login.js @@ -158,7 +158,20 @@ function Login() { }) .catch(error => { console.log("error=", error); - setError(error.toString()); + const data = { + email: username, + password: password + }; + const cmd = { + host: 'lightapi.net', + service: 'user', + action: 'loginUser', + version: '0.1.0', + data: data + }; + const url = '/portal/query?cmd=' + encodeURIComponent(JSON.stringify(cmd)); + const message = 'Login Failed! Click here to identify root cause.' + setError(message.replace('link', url)); }); }; diff --git a/login-view/src/setupProxy.js b/login-view/src/setupProxy.js index 1911e10e..7c1226a8 100644 --- a/login-view/src/setupProxy.js +++ b/login-view/src/setupProxy.js @@ -3,4 +3,5 @@ const { createProxyMiddleware } = require('http-proxy-middleware'); module.exports = function(app) { app.use('/oauth2/code', createProxyMiddleware({ target: 'https://localhost:6881', secure: false })); app.use('/portal/command', createProxyMiddleware({ target: 'https://localhost:8441', secure: false })); + app.use('/portal/query', createProxyMiddleware({ target: 'https://localhost:8442', secure: false })); };