summaryrefslogtreecommitdiffstats
path: root/webapp/components/create_team
diff options
context:
space:
mode:
authorNick Frazier <nrflaw@gmail.com>2016-10-17 10:49:59 -0400
committerenahum <nahumhbl@gmail.com>2016-10-17 11:49:59 -0300
commit06e5c097b362eeb84131406acc0c44420ae41271 (patch)
tree4a424bc26556188f15f30cf869fe21bcb02f2c31 /webapp/components/create_team
parenteac472b44f720c5876c8fb8e3944f70d6a6f3262 (diff)
downloadchat-06e5c097b362eeb84131406acc0c44420ae41271.tar.gz
chat-06e5c097b362eeb84131406acc0c44420ae41271.tar.bz2
chat-06e5c097b362eeb84131406acc0c44420ae41271.zip
fixed incorrect error display when trying a team URL with one character (#4223)
Diffstat (limited to 'webapp/components/create_team')
-rw-r--r--webapp/components/create_team/components/team_url.jsx12
1 files changed, 7 insertions, 5 deletions
diff --git a/webapp/components/create_team/components/team_url.jsx b/webapp/components/create_team/components/team_url.jsx
index b6c7d38f3..d2ccc97d9 100644
--- a/webapp/components/create_team/components/team_url.jsx
+++ b/webapp/components/create_team/components/team_url.jsx
@@ -36,20 +36,22 @@ export default class TeamUrl extends React.Component {
e.preventDefault();
const name = ReactDOM.findDOMNode(this.refs.name).value.trim();
+ const cleanedName = Utils.cleanUpUrlable(name);
+ const urlRegex = /^[a-z]+([a-z\-0-9]+|(__)?)[a-z0-9]+$/g;
+
if (!name) {
this.setState({nameError: Utils.localizeMessage('create_team.team_url.required', 'This field is required')});
return;
}
- const cleanedName = Utils.cleanUpUrlable(name);
+ if (cleanedName.length < Constants.MIN_TEAMNAME_LENGTH || cleanedName.length > Constants.MAX_TEAMNAME_LENGTH) {
+ this.setState({nameError: Utils.localizeMessage('create_team.team_url.charLength', 'Name must be 4 or more characters up to a maximum of 15')});
+ return;
+ }
- const urlRegex = /^[a-z]+([a-z\-0-9]+|(__)?)[a-z0-9]+$/g;
if (cleanedName !== name || !urlRegex.test(name)) {
this.setState({nameError: Utils.localizeMessage('create_team.team_url.regex', "Use only lower case letters, numbers and dashes. Must start with a letter and can't end in a dash.")});
return;
- } else if (cleanedName.length < Constants.MIN_TEAMNAME_LENGTH || cleanedName.length > Constants.MAX_TEAMNAME_LENGTH) {
- this.setState({nameError: Utils.localizeMessage('create_team.team_url.charLength', 'Name must be 4 or more characters up to a maximum of 15')});
- return;
}
if (global.window.mm_config.RestrictTeamNames === 'true') {