Skip to content

Commit

Permalink
Merge pull request #8146 from astax-t/issue-8145
Browse files Browse the repository at this point in the history
[FIX] Fix iframe login API response (issue #8145)
  • Loading branch information
rodrigok committed Sep 18, 2017
1 parent 16e1877 commit cc4702f
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions packages/rocketchat-iframe-login/iframe_client.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ class IframeLogin {

HTTP.call(this.apiMethod, this.apiUrl, options, (error, result) => {
console.log(error, result);
if (result && result.data && result.data.token) {
if (result && result.data && (result.data.token || result.data.loginToken)) {
this.loginWithToken(result.data, (error, result) => {
if (error) {
this.reactiveIframeUrl.set(iframeUrl);
Expand All @@ -82,27 +82,27 @@ class IframeLogin {
});
}

loginWithToken(token, callback) {
loginWithToken(tokenData, callback) {
if (!this.enabled) {
return;
}

if (Match.test(token, String)) {
token = {
token
if (Match.test(tokenData, String)) {
tokenData = {
token: tokenData
};
}

console.log('loginWithToken');

if (token.loginToken) {
return Meteor.loginWithToken(token.loginToken, callback);
if (tokenData.loginToken) {
return Meteor.loginWithToken(tokenData.loginToken, callback);
}

Accounts.callLoginMethod({
methodArguments: [{
iframe: true,
token: token.token
token: tokenData.token
}],
userCallback: callback
});
Expand Down

0 comments on commit cc4702f

Please sign in to comment.