Skip to content

Commit

Permalink
allow login screen to be skipped for test repo demos
Browse files Browse the repository at this point in the history
  • Loading branch information
erquhart committed Apr 19, 2018
1 parent 9975c7e commit 912beb4
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
12 changes: 12 additions & 0 deletions src/backends/test-repo/AuthenticationPage.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,25 @@
import PropTypes from 'prop-types';
import ImmutablePropTypes from 'react-immutable-proptypes';
import React from 'react';
import { Icon } from 'UI';

export default class AuthenticationPage extends React.Component {
static propTypes = {
onLogin: PropTypes.func.isRequired,
inProgress: PropTypes.bool,
config: ImmutablePropTypes.map.isRequired,
};

componentWillMount() {
/**
* Allow login screen to be skipped for demo purposes.
*/
const skipLogin = this.props.config.getIn(['backend', 'login']) === false;
if (skipLogin) {
this.props.onLogin(this.state);
}
}

handleLogin = (e) => {
e.preventDefault();
this.props.onLogin(this.state);
Expand Down
3 changes: 2 additions & 1 deletion src/components/App/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,8 @@ class App extends React.Component {
error: auth && auth.get('error'),
isFetching: auth && auth.get('isFetching'),
siteId: this.props.config.getIn(["backend", "site_domain"]),
base_url: this.props.config.getIn(["backend", "base_url"], null)
base_url: this.props.config.getIn(["backend", "base_url"], null),
config: this.props.config,
})
}
</div>
Expand Down

0 comments on commit 912beb4

Please sign in to comment.