summaryrefslogtreecommitdiffstats
path: root/webapp/components/login/components/login_ldap.jsx
diff options
context:
space:
mode:
authorJoramWilander <jwawilander@gmail.com>2016-03-30 12:49:29 -0400
committerJoramWilander <jwawilander@gmail.com>2016-03-30 12:49:29 -0400
commitf9a3a4b3949dddecae413b97904c895b2cd887bf (patch)
treebb77628b0aba959feeab28a5a10fe0bc0e6b4ecc /webapp/components/login/components/login_ldap.jsx
parent2aa0d9b8fc2e31e51bbddc8d90fe801c089f7c4b (diff)
downloadchat-f9a3a4b3949dddecae413b97904c895b2cd887bf.tar.gz
chat-f9a3a4b3949dddecae413b97904c895b2cd887bf.tar.bz2
chat-f9a3a4b3949dddecae413b97904c895b2cd887bf.zip
Add MFA functionality
Diffstat (limited to 'webapp/components/login/components/login_ldap.jsx')
-rw-r--r--webapp/components/login/components/login_ldap.jsx101
1 files changed, 101 insertions, 0 deletions
diff --git a/webapp/components/login/components/login_ldap.jsx b/webapp/components/login/components/login_ldap.jsx
new file mode 100644
index 000000000..a2013710f
--- /dev/null
+++ b/webapp/components/login/components/login_ldap.jsx
@@ -0,0 +1,101 @@
+// Copyright (c) 2015 Mattermost, Inc. All Rights Reserved.
+// See License.txt for license information.
+
+import * as Utils from 'utils/utils.jsx';
+import Constants from 'utils/constants.jsx';
+
+import {FormattedMessage} from 'react-intl';
+
+import React from 'react';
+
+export default class LoginLdap extends React.Component {
+ constructor(props) {
+ super(props);
+
+ this.handleSubmit = this.handleSubmit.bind(this);
+
+ this.state = {
+ serverError: props.serverError
+ };
+ }
+ componentWillReceiveProps(nextProps) {
+ this.setState({serverError: nextProps.serverError});
+ }
+ handleSubmit(e) {
+ e.preventDefault();
+ const state = {};
+
+ const id = this.refs.id.value.trim();
+ if (!id) {
+ state.serverError = Utils.localizeMessage('login_ldap.idlReq', 'An LDAP ID is required');
+ this.setState(state);
+ return;
+ }
+
+ const password = this.refs.password.value.trim();
+ if (!password) {
+ state.serverError = Utils.localizeMessage('login_ldap.pwdReq', 'An LDAP password is required');
+ this.setState(state);
+ return;
+ }
+
+ state.serverError = '';
+ this.setState(state);
+
+ this.props.submit(Constants.LDAP_SERVICE, id, password);
+ }
+ render() {
+ let serverError;
+ let errorClass = '';
+ if (this.state.serverError) {
+ serverError = <label className='control-label'>{this.state.serverError}</label>;
+ errorClass = ' has-error';
+ }
+
+ return (
+ <form onSubmit={this.handleSubmit}>
+ <div className='signup__email-container'>
+ <div className={'form-group' + errorClass}>
+ {serverError}
+ </div>
+ <div className={'form-group' + errorClass}>
+ <input
+ autoFocus={true}
+ className='form-control'
+ ref='id'
+ placeholder={Utils.localizeMessage('login_ldap.username', 'LDAP Username')}
+ spellCheck='false'
+ />
+ </div>
+ <div className={'form-group' + errorClass}>
+ <input
+ type='password'
+ className='form-control'
+ ref='password'
+ placeholder={Utils.localizeMessage('login_ldap.pwd', 'LDAP Password')}
+ spellCheck='false'
+ />
+ </div>
+ <div className='form-group'>
+ <button
+ type='submit'
+ className='btn btn-primary'
+ >
+ <FormattedMessage
+ id='login_ldap.signin'
+ defaultMessage='Sign in'
+ />
+ </button>
+ </div>
+ </div>
+ </form>
+ );
+ }
+}
+LoginLdap.defaultProps = {
+};
+
+LoginLdap.propTypes = {
+ serverError: React.PropTypes.string,
+ submit: React.PropTypes.func.isRequired
+};