copy logic from RegistrationForm to detect invalid localparts
This commit is contained in:
parent
8fd0ced215
commit
25d1d21d93
1 changed files with 9 additions and 0 deletions
|
@ -106,6 +106,15 @@ export default React.createClass({
|
||||||
},
|
},
|
||||||
|
|
||||||
_doUsernameCheck: function() {
|
_doUsernameCheck: function() {
|
||||||
|
// XXX: SPEC-1
|
||||||
|
// Check if username is valid
|
||||||
|
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.resolve();
|
||||||
|
}
|
||||||
|
|
||||||
// Check if username is available
|
// Check if username is available
|
||||||
return this._matrixClient.isUsernameAvailable(this.state.username).then(
|
return this._matrixClient.isUsernameAvailable(this.state.username).then(
|
||||||
(isAvailable) => {
|
(isAvailable) => {
|
||||||
|
|
Loading…
Reference in a new issue