Notify MatrixChat of teamToken after login
This commit is contained in:
parent
fd3c1ab9e1
commit
e1a40a8ef0
2 changed files with 18 additions and 2 deletions
|
@ -304,6 +304,10 @@ export function setLoggedIn(credentials) {
|
||||||
rtsClient.login(credentials.userId).then((body) => {
|
rtsClient.login(credentials.userId).then((body) => {
|
||||||
if (body.team_token) {
|
if (body.team_token) {
|
||||||
localStorage.setItem("mx_team_token", body.team_token);
|
localStorage.setItem("mx_team_token", body.team_token);
|
||||||
|
dis.dispatch({
|
||||||
|
action: 'set_team_token',
|
||||||
|
value: body.team_token,
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}, (err) =>{
|
}, (err) =>{
|
||||||
console.error(
|
console.error(
|
||||||
|
|
|
@ -518,6 +518,9 @@ module.exports = React.createClass({
|
||||||
case 'set_theme':
|
case 'set_theme':
|
||||||
this._onSetTheme(payload.value);
|
this._onSetTheme(payload.value);
|
||||||
break;
|
break;
|
||||||
|
case 'set_team_token':
|
||||||
|
this._onSetTeamToken(payload.value);
|
||||||
|
break;
|
||||||
case 'on_logged_in':
|
case 'on_logged_in':
|
||||||
this._onLoggedIn();
|
this._onLoggedIn();
|
||||||
break;
|
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
|
* Called when a new logged in session has started
|
||||||
*/
|
*/
|
||||||
|
@ -1003,8 +1016,7 @@ module.exports = React.createClass({
|
||||||
},
|
},
|
||||||
|
|
||||||
onTeamMemberRegistered: function(teamToken) {
|
onTeamMemberRegistered: function(teamToken) {
|
||||||
this._teamToken = teamToken;
|
this._onSetTeamToken(teamToken);
|
||||||
this._setPage(PageTypes.HomePage);
|
|
||||||
},
|
},
|
||||||
|
|
||||||
onFinishPostRegistration: function() {
|
onFinishPostRegistration: function() {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue