From c8ca70870f1e202eb5784839520199fdf0beaeec Mon Sep 17 00:00:00 2001 From: Elias Nahum Date: Wed, 27 Jan 2016 15:49:26 -0300 Subject: PLT-7: Refactoring frontend (chunk 2) - System Console complete --- .../components/admin_console/ldap_settings.jsx | 266 +++++++++++++++++---- 1 file changed, 214 insertions(+), 52 deletions(-) (limited to 'web/react/components/admin_console/ldap_settings.jsx') diff --git a/web/react/components/admin_console/ldap_settings.jsx b/web/react/components/admin_console/ldap_settings.jsx index 1447f3bd7..bc13b3bcd 100644 --- a/web/react/components/admin_console/ldap_settings.jsx +++ b/web/react/components/admin_console/ldap_settings.jsx @@ -4,10 +4,55 @@ import * as Client from '../../utils/client.jsx'; import * as AsyncClient from '../../utils/async_client.jsx'; +import {injectIntl, intlShape, defineMessages, FormattedMessage, FormattedHTMLMessage} from 'mm-intl'; + const DEFAULT_LDAP_PORT = 389; const DEFAULT_QUERY_TIMEOUT = 60; -export default class LdapSettings extends React.Component { +var holders = defineMessages({ + serverEx: { + id: 'admin.ldap.serverEx', + defaultMessage: 'Ex "10.0.0.23"' + }, + portEx: { + id: 'admin.ldap.portEx', + defaultMessage: 'Ex "389"' + }, + baseEx: { + id: 'admin.ldap.baseEx', + defaultMessage: 'Ex "dc=mydomain,dc=com"' + }, + firstnameAttrEx: { + id: 'admin.ldap.firstnameAttrEx', + defaultMessage: 'Ex "givenName"' + }, + lastnameAttrEx: { + id: 'admin.ldap.lastnameAttrEx', + defaultMessage: 'Ex "sn"' + }, + emailAttrEx: { + id: 'admin.ldap.emailAttrEx', + defaultMessage: 'Ex "mail"' + }, + usernameAttrEx: { + id: 'admin.ldap.usernameAttrEx', + defaultMessage: 'Ex "sAMAccountName"' + }, + idAttrEx: { + id: 'admin.ldap.idAttrEx', + defaultMessage: 'Ex "sAMAccountName"' + }, + queryEx: { + id: 'admin.ldap.queryEx', + defaultMessage: 'Ex "60"' + }, + saving: { + id: 'admin.ldap.saving', + defaultMessage: 'Saving Config...' + } +}); + +class LdapSettings extends React.Component { constructor(props) { super(props); @@ -80,6 +125,7 @@ export default class LdapSettings extends React.Component { ); } render() { + const {formatMessage} = this.props.intl; let serverError = ''; if (this.state.serverError) { serverError =
; @@ -97,8 +143,18 @@ export default class LdapSettings extends React.Component { bannerContent = (
-

{'Note:'}

-

{'If a user attribute changes on the LDAP server it will be updated the next time the user enters their credentials to log in to Mattermost. This includes if a user is made inactive or removed from an LDAP server. Synchronization with LDAP servers is planned in a future release.'}

+

+ +

+

+ +

); @@ -106,17 +162,10 @@ export default class LdapSettings extends React.Component { bannerContent = (
-

{'Note:'}

-

- {'LDAP is an enterprise feature. Your current license does not support LDAP. Click '} - - {'here'} - - {' for information and pricing on enterprise licenses.'} -

+
); @@ -125,7 +174,12 @@ export default class LdapSettings extends React.Component { return (
{bannerContent} -

{'LDAP Settings'}

+

+ +

- {'Enable Login With LDAP:'} +
-

{'When true, Mattermost allows login using LDAP'}

+

+ +

@@ -168,7 +236,10 @@ export default class LdapSettings extends React.Component { className='control-label col-sm-4' htmlFor='LdapServer' > - {'LDAP Server:'} +
-

{'The domain or IP address of LDAP server.'}

+

+ +

@@ -189,7 +265,10 @@ export default class LdapSettings extends React.Component { className='control-label col-sm-4' htmlFor='LdapPort' > - {'LDAP Port:'} +
-

{'The port Mattermost will use to connect to the LDAP server. Default is 389.'}

+

+ +

@@ -210,7 +294,10 @@ export default class LdapSettings extends React.Component { className='control-label col-sm-4' htmlFor='BaseDN' > - {'BaseDN:'} +
-

{'The Base DN is the Distinguished Name of the location where Mattermost should start its search for users in the LDAP tree.'}

+

+ +

@@ -231,7 +323,10 @@ export default class LdapSettings extends React.Component { className='control-label col-sm-4' htmlFor='BindUsername' > - {'Bind Username:'} +
-

{'The username used to perform the LDAP search. This should typically be an account created specifically for use with Mattermost. It should have access limited to read the portion of the LDAP tree specified in the BaseDN field.'}

+

+ +

@@ -252,7 +352,10 @@ export default class LdapSettings extends React.Component { className='control-label col-sm-4' htmlFor='BindPassword' > - {'Bind Password:'} +
-

{'Password of the user given in "Bind Username".'}

+

+ +

@@ -273,7 +381,10 @@ export default class LdapSettings extends React.Component { className='control-label col-sm-4' htmlFor='FirstNameAttribute' > - {'First Name Attrubute'} +
-

{'The attribute in the LDAP server that will be used to populate the first name of users in Mattermost.'}

+

+ +

@@ -294,7 +410,10 @@ export default class LdapSettings extends React.Component { className='control-label col-sm-4' htmlFor='LastNameAttribute' > - {'Last Name Attribute:'} +
-

{'The attribute in the LDAP server that will be used to populate the last name of users in Mattermost.'}

+

+ +

@@ -315,7 +439,10 @@ export default class LdapSettings extends React.Component { className='control-label col-sm-4' htmlFor='EmailAttribute' > - {'Email Attribute:'} +
-

{'The attribute in the LDAP server that will be used to populate the email addresses of users in Mattermost.'}

+

+ +

@@ -336,7 +468,10 @@ export default class LdapSettings extends React.Component { className='control-label col-sm-4' htmlFor='UsernameAttribute' > - {'Username Attribute:'} +
-

{'The attribute in the LDAP server that will be used to populate the username field in Mattermost. This may be the same as the ID Attribute.'}

+

+ +

@@ -357,7 +497,10 @@ export default class LdapSettings extends React.Component { className='control-label col-sm-4' htmlFor='IdAttribute' > - {'Id Attribute: '} +
-

{'The attribute in the LDAP server that will be used as a unique identifier in Mattermost. It should be an LDAP attribute with a value that does not change, such as username or uid. If a user’s Id Attribute changes, it will create a new Mattermost account unassociated with their old one. This is the value used to log in to Mattermost in the "LDAP Username" field on the sign in page. Normally this attribute is the same as the “Username Attribute” field above. If your team typically uses domain\\username to sign in to other services with LDAP, you may choose to put domain\\username in this field to maintain consistency between sites.'}

+

+ +

@@ -378,7 +526,10 @@ export default class LdapSettings extends React.Component { className='control-label col-sm-4' htmlFor='QueryTimeout' > - {'Query Timeout (seconds):'} +
-

{'The timeout value for queries to the LDAP server. Increase if you are getting timeout errors caused by a slow LDAP server.'}

+

+ +

@@ -403,9 +559,12 @@ export default class LdapSettings extends React.Component { className={saveClass} onClick={this.handleSubmit} id='save-button' - data-loading-text={' Saving Config...'} + data-loading-text={' ' + formatMessage(holders.saving)} > - {'Save'} +
@@ -418,5 +577,8 @@ LdapSettings.defaultProps = { }; LdapSettings.propTypes = { + intl: intlShape.isRequired, config: React.PropTypes.object }; + +export default injectIntl(LdapSettings); \ No newline at end of file -- cgit v1.2.3-1-g7c22