diff options
Diffstat (limited to 'web/react/components')
19 files changed, 330 insertions, 44 deletions
diff --git a/web/react/components/admin_console/ldap_settings.jsx b/web/react/components/admin_console/ldap_settings.jsx index 535c264dd..4cd19c886 100644 --- a/web/react/components/admin_console/ldap_settings.jsx +++ b/web/react/components/admin_console/ldap_settings.jsx @@ -20,7 +20,7 @@ var holders = defineMessages({ }, baseEx: { id: 'admin.ldap.baseEx', - defaultMessage: 'Ex "dc=mydomain,dc=com"' + defaultMessage: 'Ex "ou=Unit Name,dc=corp,dc=example,dc=com"' }, firstnameAttrEx: { id: 'admin.ldap.firstnameAttrEx', @@ -32,7 +32,7 @@ var holders = defineMessages({ }, emailAttrEx: { id: 'admin.ldap.emailAttrEx', - defaultMessage: 'Ex "mail"' + defaultMessage: 'Ex "mail" or "userPrincipalName"' }, usernameAttrEx: { id: 'admin.ldap.usernameAttrEx', @@ -581,4 +581,4 @@ LdapSettings.propTypes = { config: React.PropTypes.object }; -export default injectIntl(LdapSettings);
\ No newline at end of file +export default injectIntl(LdapSettings); diff --git a/web/react/components/channel_members_modal.jsx b/web/react/components/channel_members_modal.jsx index 3ec93a616..dc8e3baaf 100644 --- a/web/react/components/channel_members_modal.jsx +++ b/web/react/components/channel_members_modal.jsx @@ -178,7 +178,6 @@ export default class ChannelMembersModal extends React.Component { this.props.onModalDismissed(); }} > - <i className='glyphicon glyphicon-envelope'/> <FormattedMessage id='channel_members_modal.addNew' defaultMessage=' Add New Members' diff --git a/web/react/components/file_attachment.jsx b/web/react/components/file_attachment.jsx index 6aeae638f..c719c6c7d 100644 --- a/web/react/components/file_attachment.jsx +++ b/web/react/components/file_attachment.jsx @@ -151,9 +151,9 @@ class FileAttachment extends React.Component { this.setState({fileSize: parseInt(data.size, 10)}); } }.bind(this), - function error() { - // Do nothing - } + function error() { + // Do nothing + } ); } else { fileSizeString = utils.fileSizeToString(this.state.fileSize); diff --git a/web/react/components/settings_sidebar.jsx b/web/react/components/settings_sidebar.jsx index 90c0e8435..da8001f6f 100644 --- a/web/react/components/settings_sidebar.jsx +++ b/web/react/components/settings_sidebar.jsx @@ -4,10 +4,6 @@ import * as Utils from '../utils/utils.jsx'; export default class SettingsSidebar extends React.Component { - componentDidUpdate() { - $('.settings-modal').find('.modal-body').scrollTop(0); - $('.settings-modal').find('.modal-body').perfectScrollbar('update'); - } constructor(props) { super(props); diff --git a/web/react/components/signup_team.jsx b/web/react/components/signup_team.jsx index 5e8ae117d..26c46dad0 100644 --- a/web/react/components/signup_team.jsx +++ b/web/react/components/signup_team.jsx @@ -4,6 +4,7 @@ import ChoosePage from './team_signup_choose_auth.jsx'; import EmailSignUpPage from './team_signup_with_email.jsx'; import SSOSignupPage from './team_signup_with_sso.jsx'; +import LdapSignUpPage from './team_signup_with_ldap.jsx'; import Constants from '../utils/constants.jsx'; import {FormattedMessage} from 'mm-intl'; @@ -24,12 +25,18 @@ export default class TeamSignUp extends React.Component { count = count + 1; } + if (global.window.mm_config.EnableLdap === 'true') { + count = count + 1; + } + if (count > 1) { this.state = {page: 'choose'}; } else if (global.window.mm_config.EnableSignUpWithEmail === 'true') { this.state = {page: 'email'}; } else if (global.window.mm_config.EnableSignUpWithGitLab === 'true') { this.state = {page: 'gitlab'}; + } else if (global.window.mm_config.EnableLdap === 'true') { + this.state = {page: 'ldap'}; } else { this.state = {page: 'none'}; } @@ -133,6 +140,13 @@ export default class TeamSignUp extends React.Component { <EmailSignUpPage/> </div> ); + } else if (this.state.page === 'ldap') { + return ( + <div> + {teamListing} + <LdapSignUpPage/> + </div> + ); } else if (this.state.page === 'gitlab') { return ( <div> diff --git a/web/react/components/team_general_tab.jsx b/web/react/components/team_general_tab.jsx index c1b2a2e7f..ef7410b2f 100644 --- a/web/react/components/team_general_tab.jsx +++ b/web/react/components/team_general_tab.jsx @@ -611,7 +611,9 @@ class GeneralTab extends React.Component { className='modal-title' ref='title' > - <i className='modal-back'></i> + <div className='modal-back'> + <i className='fa fa-angle-left'></i> + </div> <FormattedMessage id='general_tab.title' defaultMessage='General Settings' diff --git a/web/react/components/team_import_tab.jsx b/web/react/components/team_import_tab.jsx index 828e9fc4e..c9a8afe6c 100644 --- a/web/react/components/team_import_tab.jsx +++ b/web/react/components/team_import_tab.jsx @@ -131,7 +131,10 @@ class TeamImportTab extends React.Component { <h4 className='modal-title' ref='title' - ><i className='modal-back'></i> + > + <div className='modal-back'> + <i className='fa fa-angle-left'></i> + </div> <FormattedMessage id='team_import_tab.import' defaultMessage='Import' diff --git a/web/react/components/team_members_dropdown.jsx b/web/react/components/team_members_dropdown.jsx index 8aacba8ca..cd7585d94 100644 --- a/web/react/components/team_members_dropdown.jsx +++ b/web/react/components/team_members_dropdown.jsx @@ -308,8 +308,8 @@ export default class TeamMembersDropdown extends React.Component { data-toggle='dropdown' aria-expanded='true' > - <span className='fa fa-pencil'></span> <span>{currentRoles} </span> + <span className='fa fa-chevron-down'></span> </a> <ul className='dropdown-menu member-menu' diff --git a/web/react/components/team_settings_modal.jsx b/web/react/components/team_settings_modal.jsx index d517f92fb..bef3ebf24 100644 --- a/web/react/components/team_settings_modal.jsx +++ b/web/react/components/team_settings_modal.jsx @@ -91,7 +91,7 @@ class TeamSettingsModal extends React.Component { /> </h4> </div> - <div className='modal-body'> + <div className='modal-body settings-modal__body'> <div className='settings-table'> <div className='settings-links'> <SettingsSidebar diff --git a/web/react/components/team_signup_choose_auth.jsx b/web/react/components/team_signup_choose_auth.jsx index 8c98c5538..5db83fe7d 100644 --- a/web/react/components/team_signup_choose_auth.jsx +++ b/web/react/components/team_signup_choose_auth.jsx @@ -58,6 +58,30 @@ export default class ChooseAuthPage extends React.Component { ); } + if (global.window.mm_config.EnableLdap === 'true') { + buttons.push( + <a + className='btn btn-custom-login ldap btn-full' + key='ldap' + href='#' + onClick={ + (e) => { + e.preventDefault(); + this.props.updatePage('ldap'); + } + } + > + <span className='icon'/> + <span> + <FormattedMessage + id='choose_auth_page.ldapCreate' + defaultMessage='Create new team with LDAP Account' + /> + </span> + </a> + ); + } + if (global.window.mm_config.EnableSignUpWithEmail === 'true') { buttons.push( <a diff --git a/web/react/components/team_signup_with_ldap.jsx b/web/react/components/team_signup_with_ldap.jsx new file mode 100644 index 000000000..8c808fa88 --- /dev/null +++ b/web/react/components/team_signup_with_ldap.jsx @@ -0,0 +1,234 @@ +// Copyright (c) 2015 Mattermost, Inc. All Rights Reserved. +// See License.txt for license information. + +import * as utils from '../utils/utils.jsx'; +import * as Client from '../utils/client.jsx'; + +import {injectIntl, intlShape, defineMessages, FormattedMessage} from 'mm-intl'; + +const holders = defineMessages({ + team_error: { + id: 'ldap_signup.team_error', + defaultMessage: 'Please enter a team name' + }, + length_error: { + id: 'ldap_signup.length_error', + defaultMessage: 'Name must be 3 or more characters up to a maximum of 15' + }, + teamName: { + id: 'ldap_signup.teamName', + defaultMessage: 'Enter name of new team' + }, + badTeam: { + id: 'login_ldap.badTeam', + defaultMessage: 'Bad team name' + }, + idReq: { + id: 'login_ldap.idlReq', + defaultMessage: 'An LDAP ID is required' + }, + pwdReq: { + id: 'login_ldap.pwdReq', + defaultMessage: 'An LDAP password is required' + }, + username: { + id: 'login_ldap.username', + defaultMessage: 'LDAP Username' + }, + pwd: { + id: 'login_ldap.pwd', + defaultMessage: 'LDAP Password' + } +}); + +class LdapSignUpPage extends React.Component { + constructor(props) { + super(props); + + this.handleSubmit = this.handleSubmit.bind(this); + this.valueChange = this.valueChange.bind(this); + + this.state = {name: '', id: '', password: ''}; + } + + handleSubmit(e) { + e.preventDefault(); + const {formatMessage} = this.props.intl; + var teamSignup = {}; + teamSignup.user = {}; + teamSignup.team = {}; + var state = this.state; + state.serverError = null; + + teamSignup.team.display_name = this.state.name; + + if (!teamSignup.team.display_name) { + state.serverError = formatMessage(holders.team_error); + this.setState(state); + return; + } + + if (teamSignup.team.display_name.length <= 2) { + state.serverError = formatMessage(holders.length_error); + this.setState(state); + return; + } + + const id = this.refs.id.value.trim(); + if (!id) { + state.serverError = formatMessage(holders.idReq); + this.setState(state); + return; + } + + const password = this.refs.password.value.trim(); + if (!password) { + state.serverError = formatMessage(holders.pwdReq); + this.setState(state); + return; + } + + state.serverError = ''; + this.setState(state); + + teamSignup.team.name = utils.cleanUpUrlable(teamSignup.team.display_name); + teamSignup.team.type = 'O'; + + teamSignup.user.username = ReactDOM.findDOMNode(this.refs.id).value.trim(); + teamSignup.user.password = ReactDOM.findDOMNode(this.refs.password).value.trim(); + teamSignup.user.allow_marketing = true; + teamSignup.user.ldap = true; + teamSignup.user.auth_service = 'ldap'; + + $('#ldap-button').button('loading'); + + Client.createTeamWithLdap(teamSignup, + () => { + Client.track('signup', 'signup_team_ldap_complete'); + + Client.loginByLdap(teamSignup.team.name, id, password, + () => { + window.location.href = '/' + teamSignup.team.name + '/channels/town-square'; + }, + (err) => { + $('#ldap-button').button('reset'); + this.setState({serverError: err.message}); + } + ); + }, + (err) => { + $('#ldap-button').button('reset'); + this.setState({serverError: err.message}); + } + ); + } + + valueChange() { + this.setState({ + name: ReactDOM.findDOMNode(this.refs.teamname).value.trim(), + id: ReactDOM.findDOMNode(this.refs.id).value.trim(), + password: ReactDOM.findDOMNode(this.refs.password).value.trim() + }); + } + + render() { + const {formatMessage} = this.props.intl; + var nameError = null; + var nameDivClass = 'form-group'; + if (this.state.nameError) { + nameError = <label className='control-label'>{this.state.nameError}</label>; + nameDivClass += ' has-error'; + } + + var serverError = null; + if (this.state.serverError) { + serverError = <div className='form-group has-error'><label className='control-label'>{this.state.serverError}</label></div>; + } + + var disabled = false; + if (this.state.name.length <= 2) { + disabled = true; + } + + if (this.state.id.length <= 1) { + disabled = true; + } + + if (this.state.password.length <= 1) { + disabled = true; + } + + return ( + <form + role='form' + onSubmit={this.handleSubmit} + > + <div className={nameDivClass}> + <input + autoFocus={true} + type='text' + ref='teamname' + className='form-control' + placeholder={this.props.intl.formatMessage(holders.teamName)} + maxLength='128' + onChange={this.valueChange} + spellCheck='false' + /> + {nameError} + </div> + <div className={nameDivClass}> + <input + className='form-control' + ref='id' + placeholder={formatMessage(holders.username)} + spellCheck='false' + onChange={this.valueChange} + /> + </div> + <div className={nameDivClass}> + <input + type='password' + className='form-control' + ref='password' + placeholder={formatMessage(holders.pwd)} + spellCheck='false' + onChange={this.valueChange} + /> + </div> + <div className='form-group'> + <a + className='btn btn-custom-login ldap btn-full' + key='ldap' + id='ldap-button' + href='#' + onClick={this.handleSubmit} + disabled={disabled} + > + <span className='icon'/> + <span> + <FormattedMessage + id='ldap_signup.ldap' + defaultMessage='Create team with LDAP Account' + /> + </span> + </a> + {serverError} + </div> + <div className='form-group margin--extra-2x'> + <span><a href='/find_team'> + <FormattedMessage + id='ldap_signup.find' + defaultMessage='Find my teams' + /> + </a></span> + </div> + </form> + ); + } +} + +LdapSignUpPage.propTypes = { + intl: intlShape.isRequired +}; + +export default injectIntl(LdapSignUpPage);
\ No newline at end of file diff --git a/web/react/components/textbox.jsx b/web/react/components/textbox.jsx index c119abcbc..46900e436 100644 --- a/web/react/components/textbox.jsx +++ b/web/react/components/textbox.jsx @@ -155,7 +155,7 @@ export default class Textbox extends React.Component { let helpText = ( <div - style={{visibility: hasText ? 'visible' : 'hidden', opacity: hasText ? '1' : '0'}} + style={{visibility: hasText ? 'visible' : 'hidden', opacity: hasText ? '0.5' : '0'}} className='help_format_text' > <b> diff --git a/web/react/components/user_settings/user_settings_advanced.jsx b/web/react/components/user_settings/user_settings_advanced.jsx index efaf63ada..cdaa5fd8a 100644 --- a/web/react/components/user_settings/user_settings_advanced.jsx +++ b/web/react/components/user_settings/user_settings_advanced.jsx @@ -300,10 +300,12 @@ class AdvancedSettingsDisplay extends React.Component { className='modal-title' ref='title' > - <i - className='modal-back' - onClick={this.props.collapseModal} - /> + <div className='modal-back'> + <i + className='fa fa-angle-left' + onClick={this.props.collapseModal} + /> + </div> <FormattedMessage id='user.settings.advance.title' defaultMessage='Advanced Settings' diff --git a/web/react/components/user_settings/user_settings_developer.jsx b/web/react/components/user_settings/user_settings_developer.jsx index 5868e0ad3..0acfd4a16 100644 --- a/web/react/components/user_settings/user_settings_developer.jsx +++ b/web/react/components/user_settings/user_settings_developer.jsx @@ -94,10 +94,12 @@ class DeveloperTab extends React.Component { className='modal-title' ref='title' > - <i - className='modal-back' - onClick={this.props.collapseModal} - /> + <div className='modal-back'> + <i + className='fa fa-angle-left' + onClick={this.props.collapseModal} + /> + </div> <FormattedMessage id='user.settings.developer.title' defaultMessage='Developer Settings' diff --git a/web/react/components/user_settings/user_settings_display.jsx b/web/react/components/user_settings/user_settings_display.jsx index 3e468e08f..b0e64b0aa 100644 --- a/web/react/components/user_settings/user_settings_display.jsx +++ b/web/react/components/user_settings/user_settings_display.jsx @@ -444,10 +444,12 @@ export default class UserSettingsDisplay extends React.Component { className='modal-title' ref='title' > - <i - className='modal-back' - onClick={this.props.collapseModal} - /> + <div className='modal-back'> + <i + className='fa fa-angle-left' + onClick={this.props.collapseModal} + /> + </div> <FormattedMessage id='user.settings.display.title' defaultMessage='Display Settings' diff --git a/web/react/components/user_settings/user_settings_general.jsx b/web/react/components/user_settings/user_settings_general.jsx index 2f2116c2a..b0b1c414e 100644 --- a/web/react/components/user_settings/user_settings_general.jsx +++ b/web/react/components/user_settings/user_settings_general.jsx @@ -759,10 +759,12 @@ class UserSettingsGeneralTab extends React.Component { className='modal-title' ref='title' > - <i - className='modal-back' - onClick={this.props.collapseModal} - /> + <div className='modal-back'> + <i + className='fa fa-angle-left' + onClick={this.props.collapseModal} + /> + </div> <FormattedMessage id='user.settings.general.title' defaultMessage='General Settings' diff --git a/web/react/components/user_settings/user_settings_integrations.jsx b/web/react/components/user_settings/user_settings_integrations.jsx index e4f460a6d..7633b2f95 100644 --- a/web/react/components/user_settings/user_settings_integrations.jsx +++ b/web/react/components/user_settings/user_settings_integrations.jsx @@ -163,10 +163,12 @@ class UserSettingsIntegrationsTab extends React.Component { className='modal-title' ref='title' > - <i - className='modal-back' - onClick={this.props.collapseModal} - /> + <div className='modal-back'> + <i + className='fa fa-angle-left' + onClick={this.props.collapseModal} + /> + </div> <FormattedMessage id='user.settings.integrations.title' defaultMessage='Integration Settings' diff --git a/web/react/components/user_settings/user_settings_notifications.jsx b/web/react/components/user_settings/user_settings_notifications.jsx index ee9febb8e..3ef6435f1 100644 --- a/web/react/components/user_settings/user_settings_notifications.jsx +++ b/web/react/components/user_settings/user_settings_notifications.jsx @@ -774,10 +774,12 @@ class NotificationsTab extends React.Component { className='modal-title' ref='title' > - <i - className='modal-back' - onClick={this.props.collapseModal} - /> + <div className='modal-back'> + <i + className='fa fa-angle-left' + onClick={this.props.collapseModal} + /> + </div> <FormattedMessage id='user.settings.notifications.title' defaultMessage='Notification Settings' diff --git a/web/react/components/user_settings/user_settings_security.jsx b/web/react/components/user_settings/user_settings_security.jsx index 53d79906f..cba7ffdea 100644 --- a/web/react/components/user_settings/user_settings_security.jsx +++ b/web/react/components/user_settings/user_settings_security.jsx @@ -389,10 +389,12 @@ class SecurityTab extends React.Component { className='modal-title' ref='title' > - <i - className='modal-back' - onClick={this.props.collapseModal} - /> + <div className='modal-back'> + <i + className='fa fa-angle-left' + onClick={this.props.collapseModal} + /> + </div> <FormattedMessage id='user.settings.security.title' defaultMessage='Security Settings' |