diff --git a/frontend/src/component/user/authentication-password-component.jsx b/frontend/src/component/user/authentication-password-component.jsx index dd1c1c4ce3..e600baa82a 100644 --- a/frontend/src/component/user/authentication-password-component.jsx +++ b/frontend/src/component/user/authentication-password-component.jsx @@ -16,6 +16,11 @@ class EnterpriseAuthenticationComponent extends React.Component { this.state = {}; } + onShowOptions = e => { + e.preventDefault(); + this.setState({ showFields: true }); + }; + handleSubmit = async evt => { evt.preventDefault(); const { username, password } = this.state; @@ -47,7 +52,7 @@ class EnterpriseAuthenticationComponent extends React.Component { } }; - render() { + renderLoginForm() { const authDetails = this.props.authDetails; const { username, usernameError, password, passwordError, error } = this.state; return ( @@ -82,6 +87,35 @@ class EnterpriseAuthenticationComponent extends React.Component { ); } + + renderWithOptions(options) { + return ( +
+ {options.map(o => ( + + + + ))} + {this.state.showFields ? ( + this.renderLoginForm() + ) : ( + + Show more options + + )} +
+ ); + } + + render() { + const { options = [] } = this.props.authDetails; + if (options.length > 0) { + return this.renderWithOptions(options); + } + return this.renderLoginForm(); + } } export default EnterpriseAuthenticationComponent;