diff options
Diffstat (limited to 'webapp/components/admin_console')
4 files changed, 23 insertions, 20 deletions
diff --git a/webapp/components/admin_console/generated_setting.jsx b/webapp/components/admin_console/generated_setting.jsx index ba6c5924b..d4feb9332 100644 --- a/webapp/components/admin_console/generated_setting.jsx +++ b/webapp/components/admin_console/generated_setting.jsx @@ -37,14 +37,9 @@ export default class GeneratedSetting extends React.Component { constructor(props) { super(props); - this.handleChange = this.handleChange.bind(this); this.regenerate = this.regenerate.bind(this); } - handleChange(e) { - this.props.onChange(this.props.id, e.target.value === 'true'); - } - regenerate(e) { e.preventDefault(); @@ -76,8 +71,7 @@ export default class GeneratedSetting extends React.Component { id={this.props.id} placeholder={this.props.placeholder} value={this.props.value} - onChange={this.handleChange} - disabled={this.props.disabled} + disabled={true} /> {disabledText} <div className='help-text'> diff --git a/webapp/components/admin_console/password_settings.jsx b/webapp/components/admin_console/password_settings.jsx index ad805b38c..6fa1dc9c4 100644 --- a/webapp/components/admin_console/password_settings.jsx +++ b/webapp/components/admin_console/password_settings.jsx @@ -23,6 +23,7 @@ export default class PasswordSettings extends AdminSettings { this.getSampleErrorMsg = this.getSampleErrorMsg.bind(this); this.handlePasswordLengthChange = this.handlePasswordLengthChange.bind(this); + this.handleCheckboxChange = this.handleCheckboxChange.bind(this); this.state = Object.assign(this.state, { passwordMinimumLength: props.config.PasswordSettings.MinimumLength, @@ -136,6 +137,11 @@ export default class PasswordSettings extends AdminSettings { this.handleChange(id, value); } + handleCheckboxChange(id, value) { + this.sampleErrorMsg = this.getSampleErrorMsg(this.state.passwordMinimumLength); + this.handleChange(id, value); + } + renderTitle() { return ( <h3> @@ -212,7 +218,7 @@ export default class PasswordSettings extends AdminSettings { ref='lowercase' defaultChecked={this.state.passwordLowercase} name='admin.password.lowercase' - onChange={this.handleChange} + onChange={this.handleCheckboxChange} /> <FormattedMessage id='admin.password.lowercase' @@ -227,7 +233,7 @@ export default class PasswordSettings extends AdminSettings { ref='uppercase' defaultChecked={this.state.passwordUppercase} name='admin.password.uppercase' - onChange={this.handleChange} + onChange={this.handleCheckboxChange} /> <FormattedMessage id='admin.password.uppercase' @@ -242,7 +248,7 @@ export default class PasswordSettings extends AdminSettings { ref='number' defaultChecked={this.state.passwordNumber} name='admin.password.number' - onChange={this.handleChange} + onChange={this.handleCheckboxChange} /> <FormattedMessage id='admin.password.number' @@ -257,7 +263,7 @@ export default class PasswordSettings extends AdminSettings { ref='symbol' defaultChecked={this.state.passwordSymbol} name='admin.password.symbol' - onChange={this.handleChange} + onChange={this.handleCheckboxChange} /> <FormattedMessage id='admin.password.symbol' diff --git a/webapp/components/admin_console/select_team_modal.jsx b/webapp/components/admin_console/select_team_modal.jsx index 2ea6cc58c..a661dd2f0 100644 --- a/webapp/components/admin_console/select_team_modal.jsx +++ b/webapp/components/admin_console/select_team_modal.jsx @@ -25,10 +25,13 @@ export default class SelectTeamModal extends React.Component { this.props.onModalDismissed(); } compare(a, b) { - if (a.display_name < b.display_name) { + const teamA = a.display_name.toLowerCase(); + const teamB = b.display_name.toLowerCase(); + + if (teamA < teamB) { return -1; } - if (a.display_name > b.display_name) { + if (teamA > teamB) { return 1; } return 0; diff --git a/webapp/components/admin_console/user_item.jsx b/webapp/components/admin_console/user_item.jsx index 974ef8bc9..78fdb085c 100644 --- a/webapp/components/admin_console/user_item.jsx +++ b/webapp/components/admin_console/user_item.jsx @@ -97,12 +97,12 @@ export default class UserItem extends React.Component { e.preventDefault(); const me = UserStore.getCurrentUser(); if (this.props.user.id === me.id) { - this.handleDemote(this.props.user, 'admin'); + this.handleDemote(this.props.user, 'team_user team_admin'); } else { Client.updateRoles( this.props.team.id, this.props.user.id, - 'admin', + 'team_user team_admin', () => { this.props.refreshProfiles(); }, @@ -119,7 +119,7 @@ export default class UserItem extends React.Component { Client.updateRoles( this.props.team.id, this.props.user.id, - 'system_admin', + 'system_user system_admin', () => { this.props.refreshProfiles(); }, @@ -238,11 +238,11 @@ export default class UserItem extends React.Component { const me = UserStore.getCurrentUser(); const email = user.email; - let showMakeMember = teamMember.roles === 'admin' || user.roles === 'system_admin'; - let showMakeAdmin = teamMember.roles === '' && user.roles !== 'system_admin'; - let showMakeSystemAdmin = user.roles === '' || user.roles === 'admin'; + let showMakeMember = Utils.isAdmin(teamMember.roles) || Utils.isSystemAdmin(user.roles); + let showMakeAdmin = !Utils.isAdmin(teamMember.roles) && !Utils.isSystemAdmin(user.roles); + let showMakeSystemAdmin = !Utils.isSystemAdmin(user.roles); let showMakeActive = false; - let showMakeNotActive = user.roles !== 'system_admin'; + let showMakeNotActive = !Utils.isSystemAdmin(user.roles); const mfaEnabled = global.window.mm_license.IsLicensed === 'true' && global.window.mm_license.MFA === 'true' && global.window.mm_config.EnableMultifactorAuthentication === 'true'; const showMfaReset = mfaEnabled && user.mfa_active; |