PLT-3192 EE: Restricted site name to 30 characters (#3560)
* Restricted site name to 30 characters * Added maxlength to TextSetting
Этот коммит содержится в:
коммит произвёл
Joram Wilander
родитель
294981d4a3
Коммит
6abc9601be
@@ -2779,6 +2779,10 @@
|
|||||||
"id": "model.config.is_valid.saml_username_attribute.app_error",
|
"id": "model.config.is_valid.saml_username_attribute.app_error",
|
||||||
"translation": "Invalid Username attribute. Must be set."
|
"translation": "Invalid Username attribute. Must be set."
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"id": "model.config.is_valid.sitename_length.app_error",
|
||||||
|
"translation": "Site name must be less than or equal to {{.MaxLength}} characters."
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"id": "model.config.is_valid.sql_data_src.app_error",
|
"id": "model.config.is_valid.sql_data_src.app_error",
|
||||||
"translation": "Invalid data source for SQL settings. Must be set."
|
"translation": "Invalid data source for SQL settings. Must be set."
|
||||||
|
|||||||
@@ -44,6 +44,8 @@ const (
|
|||||||
RESTRICT_EMOJI_CREATION_ALL = "all"
|
RESTRICT_EMOJI_CREATION_ALL = "all"
|
||||||
RESTRICT_EMOJI_CREATION_ADMIN = "admin"
|
RESTRICT_EMOJI_CREATION_ADMIN = "admin"
|
||||||
RESTRICT_EMOJI_CREATION_SYSTEM_ADMIN = "system_admin"
|
RESTRICT_EMOJI_CREATION_SYSTEM_ADMIN = "system_admin"
|
||||||
|
|
||||||
|
SITENAME_MAX_LENGTH = 30
|
||||||
)
|
)
|
||||||
|
|
||||||
type ServiceSettings struct {
|
type ServiceSettings struct {
|
||||||
@@ -960,6 +962,10 @@ func (o *Config) IsValid() *AppError {
|
|||||||
return NewLocAppError("Config.IsValid", "model.config.is_valid.password_length.app_error", map[string]interface{}{"MinLength": PASSWORD_MINIMUM_LENGTH, "MaxLength": PASSWORD_MAXIMUM_LENGTH}, "")
|
return NewLocAppError("Config.IsValid", "model.config.is_valid.password_length.app_error", map[string]interface{}{"MinLength": PASSWORD_MINIMUM_LENGTH, "MaxLength": PASSWORD_MAXIMUM_LENGTH}, "")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if len(o.TeamSettings.SiteName) > SITENAME_MAX_LENGTH {
|
||||||
|
return NewLocAppError("Config.IsValid", "model.config.is_valid.sitename_length.app_error", map[string]interface{}{"MaxLength": SITENAME_MAX_LENGTH}, "")
|
||||||
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import BrandImageSetting from './brand_image_setting.jsx';
|
|||||||
import {FormattedMessage} from 'react-intl';
|
import {FormattedMessage} from 'react-intl';
|
||||||
import SettingsGroup from './settings_group.jsx';
|
import SettingsGroup from './settings_group.jsx';
|
||||||
import TextSetting from './text_setting.jsx';
|
import TextSetting from './text_setting.jsx';
|
||||||
|
import Constants from 'utils/constants.jsx';
|
||||||
|
|
||||||
export default class CustomBrandSettings extends AdminSettings {
|
export default class CustomBrandSettings extends AdminSettings {
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
@@ -115,6 +116,7 @@ export default class CustomBrandSettings extends AdminSettings {
|
|||||||
defaultMessage='Site Name:'
|
defaultMessage='Site Name:'
|
||||||
/>
|
/>
|
||||||
}
|
}
|
||||||
|
maxLength={Constants.MAX_SITENAME_LENGTH}
|
||||||
placeholder={Utils.localizeMessage('admin.team.siteNameExample', 'Ex "Mattermost"')}
|
placeholder={Utils.localizeMessage('admin.team.siteNameExample', 'Ex "Mattermost"')}
|
||||||
helpText={
|
helpText={
|
||||||
<FormattedMessage
|
<FormattedMessage
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
|
||||||
import Setting from './setting.jsx';
|
import Setting from './setting.jsx';
|
||||||
|
import Constants from 'utils/constants.jsx';
|
||||||
|
|
||||||
export default class TextSetting extends React.Component {
|
export default class TextSetting extends React.Component {
|
||||||
static get propTypes() {
|
static get propTypes() {
|
||||||
@@ -16,6 +17,7 @@ export default class TextSetting extends React.Component {
|
|||||||
React.PropTypes.string,
|
React.PropTypes.string,
|
||||||
React.PropTypes.number
|
React.PropTypes.number
|
||||||
]).isRequired,
|
]).isRequired,
|
||||||
|
maxLength: React.PropTypes.number,
|
||||||
onChange: React.PropTypes.func.isRequired,
|
onChange: React.PropTypes.func.isRequired,
|
||||||
disabled: React.PropTypes.bool,
|
disabled: React.PropTypes.bool,
|
||||||
type: React.PropTypes.oneOf([
|
type: React.PropTypes.oneOf([
|
||||||
@@ -27,7 +29,8 @@ export default class TextSetting extends React.Component {
|
|||||||
|
|
||||||
static get defaultProps() {
|
static get defaultProps() {
|
||||||
return {
|
return {
|
||||||
type: 'input'
|
type: 'input',
|
||||||
|
maxLength: Constants.MAX_TEXTSETTING_LENGTH
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -51,6 +54,7 @@ export default class TextSetting extends React.Component {
|
|||||||
type='text'
|
type='text'
|
||||||
placeholder={this.props.placeholder}
|
placeholder={this.props.placeholder}
|
||||||
value={this.props.value}
|
value={this.props.value}
|
||||||
|
maxLength={this.props.maxLength}
|
||||||
onChange={this.handleChange}
|
onChange={this.handleChange}
|
||||||
disabled={this.props.disabled}
|
disabled={this.props.disabled}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -761,6 +761,8 @@ export default {
|
|||||||
MAX_PASSWORD_LENGTH: 64,
|
MAX_PASSWORD_LENGTH: 64,
|
||||||
MIN_TRIGGER_LENGTH: 1,
|
MIN_TRIGGER_LENGTH: 1,
|
||||||
MAX_TRIGGER_LENGTH: 128,
|
MAX_TRIGGER_LENGTH: 128,
|
||||||
|
MAX_TEXTSETTING_LENGTH: 1024,
|
||||||
|
MAX_SITENAME_LENGTH: 30,
|
||||||
TIME_SINCE_UPDATE_INTERVAL: 30000,
|
TIME_SINCE_UPDATE_INTERVAL: 30000,
|
||||||
MIN_HASHTAG_LINK_LENGTH: 3,
|
MIN_HASHTAG_LINK_LENGTH: 3,
|
||||||
CHANNEL_SCROLL_ADJUSTMENT: 100,
|
CHANNEL_SCROLL_ADJUSTMENT: 100,
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user