allow login screen to be skipped for test repo demos

This commit is contained in:
Shawn Erquhart 2018-04-19 13:06:08 -04:00
parent 1a3454f244
commit df7486333b
2 changed files with 14 additions and 1 deletions

View File

@ -1,4 +1,5 @@
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import ImmutablePropTypes from 'react-immutable-proptypes';
import React from 'react'; import React from 'react';
import { Icon } from 'UI'; import { Icon } from 'UI';
@ -6,8 +7,19 @@ export default class AuthenticationPage extends React.Component {
static propTypes = { static propTypes = {
onLogin: PropTypes.func.isRequired, onLogin: PropTypes.func.isRequired,
inProgress: PropTypes.bool, 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) => { handleLogin = (e) => {
e.preventDefault(); e.preventDefault();
this.props.onLogin(this.state); this.props.onLogin(this.state);

View File

@ -83,7 +83,8 @@ class App extends React.Component {
error: auth && auth.get('error'), error: auth && auth.get('error'),
isFetching: auth && auth.get('isFetching'), isFetching: auth && auth.get('isFetching'),
siteId: this.props.config.getIn(["backend", "site_domain"]), 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> </div>