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

Unified Diff: chrome/browser/resources/gaia_auth_host/authenticator.js

Issue 1344443002: Implement new password separated sign in flow for chrome desktop. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: merged Created 5 years, 2 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_host/authenticator.js
diff --git a/chrome/browser/resources/gaia_auth_host/authenticator.js b/chrome/browser/resources/gaia_auth_host/authenticator.js
index 64627402bb771b603a13c399d3a42e4f69e22c9c..98957364d8398984d2d4846dcf2684a56cd259b5 100644
--- a/chrome/browser/resources/gaia_auth_host/authenticator.js
+++ b/chrome/browser/resources/gaia_auth_host/authenticator.js
@@ -202,7 +202,7 @@ cr.define('cr.login', function() {
this.continueUrl_.substring(0, this.continueUrl_.indexOf('?')) ||
this.continueUrl_;
this.isConstrainedWindow_ = data.constrained == '1';
- this.isNewGaiaFlowChromeOS = data.isNewGaiaFlowChromeOS;
+ this.isNewGaiaFlow = data.isNewGaiaFlow;
this.useEafe_ = data.useEafe || false;
this.clientId_ = data.clientId;
this.gapsCookie_ = data.gapsCookie;
@@ -218,7 +218,7 @@ cr.define('cr.login', function() {
this.idpOrigin_.indexOf('https://') == 0;
this.needPassword = !('needPassword' in data) || data.needPassword;
- if (this.isNewGaiaFlowChromeOS) {
+ if (this.isNewGaiaFlow) {
this.webview_.contextMenus.onShow.addListener(function(e) {
e.preventDefault();
});
@@ -247,13 +247,13 @@ cr.define('cr.login', function() {
Authenticator.prototype.constructInitialFrameUrl_ = function(data) {
var path = data.gaiaPath;
- if (!path && this.isNewGaiaFlowChromeOS)
+ if (!path && this.isNewGaiaFlow)
path = EMBEDDED_SETUP_CHROMEOS_ENDPOINT;
if (!path)
path = IDP_PATH;
var url = this.idpOrigin_ + path;
- if (this.isNewGaiaFlowChromeOS) {
+ if (this.isNewGaiaFlow) {
if (data.chromeType)
url = appendParam(url, 'chrometype', data.chromeType);
if (data.clientId)
@@ -276,8 +276,27 @@ cr.define('cr.login', function() {
url = appendParam(url, 'hl', data.hl);
if (data.gaiaId)
url = appendParam(url, 'user_id', data.gaiaId);
- if (data.email)
- url = appendParam(url, 'Email', data.email);
+ if (data.email) {
+ // The email fields allow for the following possibilities:
+ //
+ // 1/ If neither Email nor email_hint is supplied, then the email text
+ // field is blank and the user must type an email to proceed.
+ //
+ // 2/ If Email is supplied, then the email is hardcoded and the user
+ // cannot change it. The user is asked for password. This is useful for
+ // re-auth scenarios, where chrome needs the user to authenticate for a
+ // specific account and only that account.
+ //
+ // 3/ If email_hint is supplied, gaia will prefill the email text field
+ // using the given email address, but the user can still change it and
+ // then proceed. This is used on desktop when the user disconnects their
+ // profile then reconnects, to encourage them to use the same account.
+ if (data.readOnlyEmail) {
+ url = appendParam(url, 'Email', data.email);
+ } else {
+ url = appendParam(url, 'email_hint', data.email);
+ }
+ }
if (this.isConstrainedWindow_)
url = appendParam(url, 'source', CONSTRAINED_FLOW_SOURCE);
if (data.flow)
@@ -397,7 +416,7 @@ cr.define('cr.login', function() {
var location = decodeURIComponent(header.value);
this.chooseWhatToSync_ = !!location.match(/(\?|&)source=3($|&)/);
} else if (
- this.isNewGaiaFlowChromeOS && headerName == SET_COOKIE_HEADER) {
+ this.isNewGaiaFlow && headerName == SET_COOKIE_HEADER) {
var headerValue = header.value;
if (headerValue.indexOf(OAUTH_CODE_COOKIE + '=', 0) == 0) {
this.oauthCode_ =
@@ -444,7 +463,7 @@ cr.define('cr.login', function() {
Authenticator.prototype.onBeforeSendHeaders_ = function(details) {
// We should re-send cookie if first request was unsuccessful (i.e. no new
// GAPS cookie was received).
- if (this.isNewGaiaFlowChromeOS && this.gapsCookie_ &&
+ if (this.isNewGaiaFlow && this.gapsCookie_ &&
(!this.gapsCookieSent_ || !this.newGapsCookie_)) {
var headers = details.requestHeaders;
var found = false;
@@ -742,10 +761,8 @@ cr.define('cr.login', function() {
* @private
*/
Authenticator.prototype.onLoadCommit_ = function(e) {
- if (this.oauthCode_) {
- this.skipForNow_ = true;
+ if (this.oauthCode_)
this.maybeCompleteAuth_();
- }
};
/**

Powered by Google App Engine
This is Rietveld 408576698