Chromium Code Reviews| Index: chrome/browser/resources/gaia_auth/main.js |
| diff --git a/chrome/browser/resources/gaia_auth/main.js b/chrome/browser/resources/gaia_auth/main.js |
| index ba48c65dc9049f2dc8cb453d754480286497b3f8..151e68db0f6bb2ae28abdd0100beaf58c0b30c7e 100644 |
| --- a/chrome/browser/resources/gaia_auth/main.js |
| +++ b/chrome/browser/resources/gaia_auth/main.js |
| @@ -48,6 +48,7 @@ Authenticator.getInstance = function() { |
| Authenticator.prototype = { |
| email_: null, |
| + gaiaId_: null, |
| // Depending on the key type chosen, this will contain the plain text password |
| // or a credential derived from it along with the information required to |
| @@ -165,9 +166,9 @@ Authenticator.prototype = { |
| }); |
| this.supportChannel_.registerMessage( |
| 'switchToFullTab', this.switchToFullTab_.bind(this)); |
| - this.supportChannel_.registerMessage( |
| - 'completeLogin', this.completeLogin_.bind(this)); |
| } |
| + this.supportChannel_.registerMessage( |
| + 'completeLogin', this.completeLogin_.bind(this)); |
|
xiyuan
2014/09/25 02:52:39
Think we need to merge onConfirmLogin_ with comple
Roger Tawa OOO till Jul 10th
2014/09/25 20:36:41
Now calls maybeCompleteLogin_(), which is the rena
|
| this.initSAML_(); |
| this.maybeInitialized_(); |
| }.bind(this)); |
| @@ -221,8 +222,9 @@ Authenticator.prototype = { |
| 'usingSAML': this.isSAMLFlow_, |
| 'chooseWhatToSync': this.chooseWhatToSync_ || false, |
| 'skipForNow': opt_extraMsg && opt_extraMsg.skipForNow, |
| - 'sessionIndex': opt_extraMsg && opt_extraMsg.sessionIndex |
| - }; |
| + 'sessionIndex': opt_extraMsg && opt_extraMsg.sessionIndex, |
| + 'gaiaId': (opt_extraMsg && opt_extraMsg.gaiaId) || this.gaiaId_ |
| + }; |
| window.parent.postMessage(msg, this.parentPage_); |
| this.supportChannel_.send({name: 'resetAuth'}); |
| }, |
| @@ -268,6 +270,7 @@ Authenticator.prototype = { |
| // from the GAIA login form are no longer relevant and can be discarded. |
| this.isSAMLFlow_ = true; |
| this.email_ = null; |
| + this.gaiaId_ = null; |
| this.passwordBytes_ = null; |
| } |
| @@ -318,6 +321,7 @@ Authenticator.prototype = { |
| } |
| this.apiToken_ = call.token; |
| this.email_ = call.user; |
| + this.gaiaId_ = null; // TODO(rogerta): no idea what to do here. |
| this.passwordBytes_ = call.passwordBytes; |
| } else if (call.method == 'confirm') { |
| if (call.token != this.apiToken_) |
| @@ -343,10 +347,8 @@ Authenticator.prototype = { |
| }, |
| onConfirmLogin_: function() { |
| - if (!this.isSAMLFlow_) { |
| - this.completeLogin_(); |
| + if (!this.isSAMLFlow_) |
| return; |
| - } |
| var apiUsed = !!this.passwordBytes_; |
| @@ -377,8 +379,10 @@ Authenticator.prototype = { |
| maybeCompleteSAMLLogin_: function() { |
| // SAML login is complete when the user's e-mail address has been retrieved |
| // from GAIA and the user has successfully confirmed the password. |
| - if (this.email_ !== null && this.passwordBytes_ !== null) |
| + if (this.email_ !== null && this.gaiaId_ !== null && |
| + this.passwordBytes_ !== null) { |
| this.completeLogin_(); |
| + } |
| }, |
| onVerifyConfirmedPassword_: function(password) { |
| @@ -401,6 +405,7 @@ Authenticator.prototype = { |
| onMessage: function(e) { |
| var msg = e.data; |
| if (msg.method == 'attemptLogin' && this.isGaiaMessage_(e)) { |
| + // At this point GAIA does not yet know the gaiaId, so its not set here. |
| this.email_ = msg.email; |
| this.passwordBytes_ = msg.password; |
| this.attemptToken_ = msg.attemptToken; |
| @@ -416,6 +421,7 @@ Authenticator.prototype = { |
| this.maybeInitialized_(); |
| } |
| this.email_ = null; |
| + this.gaiaId_ = null; |
| this.passwordBytes_ = null; |
| this.attemptToken_ = null; |
| this.isSAMLFlow_ = false; |