Notify MatrixChat of teamToken after login

pull/21833/head
Luke Barnard 2017-02-23 16:30:26 +00:00
parent fd3c1ab9e1
commit e1a40a8ef0
2 changed files with 18 additions and 2 deletions

View File

@ -304,6 +304,10 @@ export function setLoggedIn(credentials) {
rtsClient.login(credentials.userId).then((body) => {
if (body.team_token) {
localStorage.setItem("mx_team_token", body.team_token);
dis.dispatch({
action: 'set_team_token',
value: body.team_token,
})
}
}, (err) =>{
console.error(

View File

@ -518,6 +518,9 @@ module.exports = React.createClass({
case 'set_theme':
this._onSetTheme(payload.value);
break;
case 'set_team_token':
this._onSetTeamToken(payload.value);
break;
case 'on_logged_in':
this._onLoggedIn();
break;
@ -692,6 +695,16 @@ module.exports = React.createClass({
}
},
/**
* Called when the team token is acquired at registration or login. This
* should only happen if the configured RTS (see config.json teamServerURL)
* recognises the user as having an email address that matches a team.
*/
_onSetTeamToken: function(teamToken) {
this._teamToken = teamToken;
this._setPage(PageTypes.HomePage);
},
/**
* Called when a new logged in session has started
*/
@ -1003,8 +1016,7 @@ module.exports = React.createClass({
},
onTeamMemberRegistered: function(teamToken) {
this._teamToken = teamToken;
this._setPage(PageTypes.HomePage);
this._onSetTeamToken(teamToken);
},
onFinishPostRegistration: function() {