Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(430)

Unified Diff: chrome/browser/resources/gaia_auth/main.js

Issue 473153002: Inline sign in extracts gaia id from HTTP header and seeds account tracker (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebased Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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;
« no previous file with comments | « chrome/browser/resources/gaia_auth/background.js ('k') | chrome/browser/resources/gaia_auth_host/gaia_auth_host.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698