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:
commit
dd33624454
4 changed files with 86 additions and 70 deletions
|
@ -277,6 +277,9 @@ export function setLoggedIn(credentials) {
|
|||
credentials.userId, credentials.guest,
|
||||
credentials.homeserverUrl);
|
||||
|
||||
// Resolves by default
|
||||
let teamPromise = Promise.resolve(null);
|
||||
|
||||
// persist the session
|
||||
if (localStorage) {
|
||||
try {
|
||||
|
@ -300,16 +303,12 @@ export function setLoggedIn(credentials) {
|
|||
console.warn("Error using local storage: can't persist session!", e);
|
||||
}
|
||||
|
||||
if (rtsClient) {
|
||||
rtsClient.login(credentials.userId).then((body) => {
|
||||
if (rtsClient && !credentials.guest) {
|
||||
teamPromise = rtsClient.login(credentials.userId).then((body) => {
|
||||
if (body.team_token) {
|
||||
localStorage.setItem("mx_team_token", body.team_token);
|
||||
}
|
||||
}, (err) =>{
|
||||
console.error(
|
||||
"Failed to get team token on login, not persisting to localStorage",
|
||||
err
|
||||
);
|
||||
return body.team_token;
|
||||
});
|
||||
}
|
||||
} else {
|
||||
|
@ -321,7 +320,12 @@ export function setLoggedIn(credentials) {
|
|||
|
||||
MatrixClientPeg.replaceUsingCreds(credentials);
|
||||
|
||||
dis.dispatch({action: 'on_logged_in'});
|
||||
teamPromise.then((teamToken) => {
|
||||
dis.dispatch({action: 'on_logged_in', teamToken: teamToken});
|
||||
}, (err) => {
|
||||
console.warn("Failed to get team token on login", err);
|
||||
dis.dispatch({action: 'on_logged_in', teamToken: null});
|
||||
});
|
||||
|
||||
startMatrixClient();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue