Redesign mxID chooser, add availability checking

Requires https://github.com/matrix-org/matrix-js-sdk/pull/432 for availability checking.

Changes:
 - Redesign the dialog to look more like https://github.com/vector-im/riot-web/issues/3604#issuecomment-299226875
 - Attempt to fix wrong password being stored by generating one per SetMxIdDialog (there's no issue tracking this for now, I shall open one if it persists)
 - Backwards compatible with servers that don't support register/availability - a spinner will appear the first time a username is checked because server support can only be determined after a request.
 - Rate-limited by a 2s debounce
 - General style improvements
This commit is contained in:
Luke Barnard 2017-05-10 14:22:17 +01:00
parent 69382d36b1
commit ad2ed12980
2 changed files with 137 additions and 28 deletions

View file

@ -775,7 +775,8 @@ module.exports = React.createClass({
const SetMxIdDialog = sdk.getComponent('views.dialogs.SetMxIdDialog');
const defered = q.defer();
mxIdPromise = defered.promise;
Modal.createDialog(SetMxIdDialog, {
const close = Modal.createDialog(SetMxIdDialog, {
homeserverUrl: cli.getHomeserverUrl(),
onFinished: (submitted, credentials) => {
if (!submitted) {
defered.reject();
@ -783,8 +784,12 @@ module.exports = React.createClass({
}
this.props.onRegistered(credentials);
defered.resolve();
}
});
},
onDifferentServerClicked: (ev) => {
dis.dispatch({action: 'start_registration'});
close();
},
}).close;
}
mxIdPromise.then(() => {