diff --git a/src/components/views/dialogs/SetMxIdDialog.js b/src/components/views/dialogs/SetMxIdDialog.js index 4d4f672f2b..554a244358 100644 --- a/src/components/views/dialogs/SetMxIdDialog.js +++ b/src/components/views/dialogs/SetMxIdDialog.js @@ -106,6 +106,16 @@ export default React.createClass({ }, _doUsernameCheck: function() { + // XXX: SPEC-1 + // Check if username is valid + // Naive impl copied from https://github.com/matrix-org/matrix-react-sdk/blob/66c3a6d9ca695780eb6b662e242e88323053ff33/src/components/views/login/RegistrationForm.js#L190 + if (encodeURIComponent(this.state.username) !== this.state.username) { + this.setState({ + usernameError: _t('User names may only contain letters, numbers, dots, hyphens and underscores.'), + }); + return Promise.reject(); + } + // Check if username is available return this._matrixClient.isUsernameAvailable(this.state.username).then( (isAvailable) => { @@ -242,7 +252,7 @@ export default React.createClass({ return (
diff --git a/src/i18n/strings/en_EN.json b/src/i18n/strings/en_EN.json index 0d5b7d9d96..5381fc2356 100644 --- a/src/i18n/strings/en_EN.json +++ b/src/i18n/strings/en_EN.json @@ -575,6 +575,7 @@ "To configure the room": "To configure the room", "to demote": "to demote", "to favourite": "to favourite", + "To get started, please pick a username!": "To get started, please pick a username!", "To invite users into the room": "To invite users into the room", "To kick users": "To kick users", "To link to a room it must have an address.": "To link to a room it must have an address.",