Merge remote-tracking branch 'origin/develop' into dbkr/register_ui_auth

(This ended up mostly being merged by hand as git made a complete
mess of the merge)
This commit is contained in:
David Baker 2017-03-01 10:45:17 +00:00
commit dd33624454
4 changed files with 86 additions and 70 deletions

View file

@ -524,7 +524,7 @@ module.exports = React.createClass({
this._onSetTheme(payload.value);
break;
case 'on_logged_in':
this._onLoggedIn();
this._onLoggedIn(payload.teamToken);
break;
case 'on_logged_out':
this._onLoggedOut();
@ -700,13 +700,20 @@ module.exports = React.createClass({
/**
* Called when a new logged in session has started
*/
_onLoggedIn: function(credentials) {
_onLoggedIn: function(teamToken) {
this.guestCreds = null;
this.notifyNewScreen('');
this.setState({
screen: undefined,
logged_in: true,
});
if (teamToken) {
this._teamToken = teamToken;
this._setPage(PageTypes.HomePage);
} else if (this._is_registered) {
this._setPage(PageTypes.UserSettings);
}
},
/**
@ -723,6 +730,7 @@ module.exports = React.createClass({
currentRoomId: null,
page_type: PageTypes.RoomDirectory,
});
this._teamToken = null;
},
/**
@ -993,23 +1001,11 @@ module.exports = React.createClass({
}
},
onRegistered: function(credentials) {
Lifecycle.setLoggedIn(credentials);
// do post-registration stuff
// This now goes straight to user settings
// We use _setPage since if we wait for
// showScreen to do the dispatch loop,
// the showScreen dispatch will race with the
// sdk sync finishing and we'll probably see
// the page type still unset when the MatrixClient
// is started and show the Room Directory instead.
//this.showScreen("view_user_settings");
this._setPage(PageTypes.UserSettings);
},
onTeamMemberRegistered: function(teamToken) {
onRegistered: function(credentials, teamToken) {
// teamToken may not be truthy
this._teamToken = teamToken;
this._setPage(PageTypes.HomePage);
this._is_registered = true;
Lifecycle.setLoggedIn(credentials);
},
onFinishPostRegistration: function() {
@ -1146,7 +1142,6 @@ module.exports = React.createClass({
customIsUrl={this.getCurrentIsUrl()}
makeRegistrationUrl={this.props.makeRegistrationUrl}
defaultDeviceDisplayName={this.props.defaultDeviceDisplayName}
onTeamMemberRegistered={this.onTeamMemberRegistered}
onLoggedIn={this.onRegistered}
onLoginClick={this.onLoginClick}
onRegisterClick={this.onRegisterClick}