Merge pull request #1259 from matrix-org/t3chguy/fix-select-mxid-dialog

Fix Set MXID Dialog woes
pull/21833/head
Luke Barnard 2017-08-09 17:53:50 +01:00 committed by GitHub
commit 794bf820cc
2 changed files with 12 additions and 1 deletions

View File

@ -106,6 +106,16 @@ export default React.createClass({
}, },
_doUsernameCheck: function() { _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 // Check if username is available
return this._matrixClient.isUsernameAvailable(this.state.username).then( return this._matrixClient.isUsernameAvailable(this.state.username).then(
(isAvailable) => { (isAvailable) => {
@ -242,7 +252,7 @@ export default React.createClass({
return ( return (
<BaseDialog className="mx_SetMxIdDialog" <BaseDialog className="mx_SetMxIdDialog"
onFinished={this.props.onFinished} onFinished={this.props.onFinished}
title="To get started, please pick a username!" title={_t('To get started, please pick a username!')}
> >
<div className="mx_Dialog_content"> <div className="mx_Dialog_content">
<div className="mx_SetMxIdDialog_input_group"> <div className="mx_SetMxIdDialog_input_group">

View File

@ -575,6 +575,7 @@
"To configure the room": "To configure the room", "To configure the room": "To configure the room",
"to demote": "to demote", "to demote": "to demote",
"to favourite": "to favourite", "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 invite users into the room": "To invite users into the room",
"To kick users": "To kick users", "To kick users": "To kick users",
"To link to a room it must have <a>an address</a>.": "To link to a room it must have <a>an address</a>.", "To link to a room it must have <a>an address</a>.": "To link to a room it must have <a>an address</a>.",