Skip to content

Commit

Permalink
PLT-3192 EE: Restricted site name to 30 characters (mattermost#3560)
Browse files Browse the repository at this point in the history
* Restricted site name to 30 characters

* Added maxlength to TextSetting
  • Loading branch information
DavidLu1997 authored and jwilander committed Jul 14, 2016
1 parent 1c885f0 commit 682eede
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
2 changes: 2 additions & 0 deletions components/admin_console/custom_brand_settings.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import BrandImageSetting from './brand_image_setting.jsx';
import {FormattedMessage} from 'react-intl';
import SettingsGroup from './settings_group.jsx';
import TextSetting from './text_setting.jsx';
import Constants from 'utils/constants.jsx';

export default class CustomBrandSettings extends AdminSettings {
constructor(props) {
Expand Down Expand Up @@ -115,6 +116,7 @@ export default class CustomBrandSettings extends AdminSettings {
defaultMessage='Site Name:'
/>
}
maxLength={Constants.MAX_SITENAME_LENGTH}
placeholder={Utils.localizeMessage('admin.team.siteNameExample', 'Ex "Mattermost"')}
helpText={
<FormattedMessage
Expand Down
6 changes: 5 additions & 1 deletion components/admin_console/text_setting.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import React from 'react';

import Setting from './setting.jsx';
import Constants from 'utils/constants.jsx';

export default class TextSetting extends React.Component {
static get propTypes() {
Expand All @@ -16,6 +17,7 @@ export default class TextSetting extends React.Component {
React.PropTypes.string,
React.PropTypes.number
]).isRequired,
maxLength: React.PropTypes.number,
onChange: React.PropTypes.func.isRequired,
disabled: React.PropTypes.bool,
type: React.PropTypes.oneOf([
Expand All @@ -27,7 +29,8 @@ export default class TextSetting extends React.Component {

static get defaultProps() {
return {
type: 'input'
type: 'input',
maxLength: Constants.MAX_TEXTSETTING_LENGTH
};
}

Expand All @@ -51,6 +54,7 @@ export default class TextSetting extends React.Component {
type='text'
placeholder={this.props.placeholder}
value={this.props.value}
maxLength={this.props.maxLength}
onChange={this.handleChange}
disabled={this.props.disabled}
/>
Expand Down
2 changes: 2 additions & 0 deletions utils/constants.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -761,6 +761,8 @@ export default {
MAX_PASSWORD_LENGTH: 64,
MIN_TRIGGER_LENGTH: 1,
MAX_TRIGGER_LENGTH: 128,
MAX_TEXTSETTING_LENGTH: 1024,
MAX_SITENAME_LENGTH: 30,
TIME_SINCE_UPDATE_INTERVAL: 30000,
MIN_HASHTAG_LINK_LENGTH: 3,
CHANNEL_SCROLL_ADJUSTMENT: 100,
Expand Down

0 comments on commit 682eede

Please sign in to comment.