Skip to content

Commit

Permalink
Remove redundant verify button before login.
Browse files Browse the repository at this point in the history
  • Loading branch information
negative0 committed Apr 11, 2020
1 parent 9172a62 commit a1a5b7c
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 18 deletions.
Binary file added src/assets/img/brand/animatedlogo.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/img/brand/logo_symbol.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion src/containers/DefaultLayout/DefaultHeader.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {NavLink} from 'react-router-dom';
import {Nav, NavItem} from 'reactstrap';
import PropTypes from 'prop-types';

import {AppAsideToggler, AppNavbarBrand, AppSidebarToggler} from '@coreui/react';
import {AppNavbarBrand, AppSidebarToggler} from '@coreui/react';
import logo from '../../assets/img/brand/logo.png'
import favicon from '../../assets/img/brand/favicon.png'
import BackendStatusCard from "../../views/Base/BackendStatusCard/BackendStatusCard";
Expand Down
34 changes: 17 additions & 17 deletions src/views/Pages/Login/Login.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import {connect} from "react-redux";
import {changeAuthKey, changeIPAddress, changeUserNamePassword, signOut} from "../../../actions/userActions";
import axiosInstance from "../../../utils/API/API";
import urls from "../../../utils/API/endpoint";
import logo from '../../../assets/img/brand/logo_symbol.png'


function removeParam(parameter) {
Expand Down Expand Up @@ -57,29 +58,25 @@ class Login extends Component {
username: "",
password: "",
ipAddress,
connectionSuccess: false,
error: ""
};
}

changeUserName = e => {
this.setState({
username: e.target.value,
connectionSuccess: false
});
};
changePassword = e => {
this.setState({
password: e.target.value,
connectionSuccess: false

})
};
changeIPAddress = e => {

this.setState({
ipAddress: e.target.value,
connectionSuccess: false
});
};

Expand All @@ -98,7 +95,17 @@ class Login extends Component {
changeUserNamePassword(username, password),
changeIPAddress(ipAddress)
]).then(() => {
this.redirectToDashboard()
axiosInstance.post(urls.noopAuth).then((data) => {
console.log("Connection successful.");
this.redirectToDashboard();
}, (error) => {
console.log(error);
this.setState({
connectionSuccess: false,
error: "Error connecting. Please check username password and verify if rclone is working at the specified IP."
})
})

});

};
Expand Down Expand Up @@ -136,7 +143,6 @@ class Login extends Component {
localStorage.clear();
this.props.signOut();


let url_string = window.location.href;
let url = new URL(url_string);
let loginToken = url.searchParams.get("login_token");
Expand All @@ -158,6 +164,7 @@ class Login extends Component {
}



render() {
const {username, password, ipAddress, connectionSuccess, error} = this.state;

Expand Down Expand Up @@ -209,23 +216,16 @@ class Login extends Component {
</InputGroup>
<Row>
<Col xs="6">
<Button color="primary" className="px-4"
data-testid="LoginForm-BtnLogin"
disabled={!connectionSuccess}>Login</Button>
</Col>
<Col xs="6" className="text-right">
<Button onClick={this.checkConnection} color="primary"
data-testid="LoginForm-BtnVerify"
className="px-4">Verify</Button>
<Button color="primary" className="px-4" type="submit"
data-testid="LoginForm-BtnLogin">Login</Button>
</Col>
</Row>
</Form>
</CardBody>
</Card>
<Card className="text-white bg-primary py-5 d-md-down-none" style={{width: '44%'}}>
<Card className="text-white bg-white py-5 d-md-down-none" style={{width: '44%'}}>
<CardBody className="text-center">
<div>
</div>
<img src={logo}/>
</CardBody>
</Card>
</CardGroup>
Expand Down

0 comments on commit a1a5b7c

Please sign in to comment.