Skip to content
This repository was archived by the owner on Jan 20, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion login-view/deploy-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
echo "Build the view in in test mode"
yarn build
echo "Build completed in build folder, start copying to remote test2 server"
scp -r ./build/* steve@test2:/home/steve/networknt/light-config-test/light-router/test-portal/signin/build
scp -r ./build steve@test2:/home/steve/light-chain/light-config-test/light-router/test-direct/signin
echo "Copied!"
6 changes: 3 additions & 3 deletions login-view/src/components/ForgetPassword.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,10 @@ function ForgetPassword() {
};

const handleSubmit = event => {
console.log("email = ", email);
//console.log("email = ", email);
event.preventDefault();
const data = { email };
console.log("data = ", data);
//console.log("data = ", data);
const action = {
'host': 'lightapi.net',
'service': 'user',
Expand All @@ -69,7 +69,7 @@ function ForgetPassword() {
throw response;
}
const data = await response.json();
console.log(data);
//console.log(data);
setError("An Email has been sent.");
} catch (e) {
const error = await e.json();
Expand Down
26 changes: 13 additions & 13 deletions login-view/src/components/Login.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ function Login() {

let search = window.location.search;
let params = new URLSearchParams(search);
console.log("client_id = ", params.get('client_id'));
//console.log("client_id = ", params.get('client_id'));
const [username, setUsername] = useState('');
const [password, setPassword] = useState('');
const [remember, setRemember] = useState(false);
Expand All @@ -60,7 +60,7 @@ function Login() {
const [denyUrl, setDenyUrl] = useState(null);
const [scopes, setScopes] = useState([]);

const handleChangeUsername = e => {
const handleChangeUsername = e => {
setUsername(e.target.value)
};

Expand All @@ -74,18 +74,18 @@ function Login() {

const handleAccept = event => {
event.preventDefault();
console.log("handleAccept is called");
//console.log("handleAccept is called");
window.location.href = redirectUrl;
}

const handleCancel = event => {
event.preventDefault();
// here we use the redirectUrl to construct the deny url because the cookies
// are saved to the redirect domain instead of signin.lightapi.net domain.
console.log("redirectUrl = ", redirectUrl);
//console.log("redirectUrl = ", redirectUrl);
let pathArray = redirectUrl.split('/');
let logoutPath = pathArray[0] + '//' + pathArray[2] + '/logout';
console.log("fetch url = ", logoutPath);
//console.log("fetch url = ", logoutPath);
// remove the server set cookies as the Javascript cannot access some of them.
fetch(logoutPath, { credentials: 'include'})
.then(response => {
Expand Down Expand Up @@ -114,8 +114,8 @@ function Login() {
}

const handleSubmit = event => {
console.log("username = " + username + " password = " + password + " remember = " + remember);
console.log("state = " + state + " clientId = " + clientId + " userType = " + userType + " redirectUri = " + redirectUri);
//console.log("username = " + username + " password = " + password + " remember = " + remember);
//console.log("state = " + state + " clientId = " + clientId + " userType = " + userType + " redirectUri = " + redirectUri);
event.preventDefault();

// state, user_type and redirect_uri might be empty
Expand All @@ -127,15 +127,15 @@ function Login() {
};

Object.assign(data, (state) && { state: state}, (userType) && {user_type: userType}, (redirectUri) && {redirect_uri: redirectUri})
console.log("data = " + data);
//console.log("data = " + data);
const formData = Object.keys(data).map(key => encodeURIComponent(key) + '=' + encodeURIComponent(data[key])).join('&');

console.log(formData);
//console.log(formData);
const headers = {
'Content-Type': 'application/x-www-form-urlencoded',
...(process.env.REACT_APP_SAAS_URL) && {'service_url': process.env.REACT_APP_SAAS_URL}
};
console.log(headers);
//console.log(headers);

fetch("/oauth2/code", {
method: 'POST',
Expand All @@ -152,7 +152,7 @@ function Login() {
}
})
.then(json => {
console.log(json);
//console.log(json);
setRedirectUrl(json.redirectUri);
setDenyUrl(json.denyUri);
setScopes(json.scopes);
Expand All @@ -177,8 +177,8 @@ function Login() {
};

if(redirectUrl !== null) {
console.log("display consent");
console.log(scopes);
//console.log("display consent");
//console.log(scopes);
return (
<Container component="main" maxWidth="xs">
<CssBaseline />
Expand Down
10 changes: 5 additions & 5 deletions login-view/src/components/ResetPassword.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ const useStyles = makeStyles(theme => ({

function ResetPassword(props) {
let params = new URLSearchParams(props.location.search);
console.log("token = ", params.get('token'));
console.log("email = ", params.get('email'));
//console.log("token = ", params.get('token'));
//console.log("email = ", params.get('email'));

const classes = useStyles();
const [newPassword, setNewPassword] = useState('');
Expand All @@ -58,10 +58,10 @@ function ResetPassword(props) {
};

const handleSubmit = event => {
console.log("email = " + email + " token = " + token);
//console.log("email = " + email + " token = " + token);
event.preventDefault();
const data = { email, token, newPassword, passwordConfirm };
console.log("data = ", data);
//console.log("data = ", data);
const action = {
'host': 'lightapi.net',
'service': 'user',
Expand All @@ -82,7 +82,7 @@ function ResetPassword(props) {
throw response;
}
const data = await response.json();
console.log(data);
//console.log(data);
setError("The password has been reset.");
} catch (e) {
const error = await e.json();
Expand Down