Chromium Code Reviews| 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 a1296a4758019dc885983f75563788d15ebcd7f6..d59dde4ce250c3a4f590be0457992602e5db9332 100644 |
| --- a/chrome/browser/resources/gaia_auth_host/authenticator.js |
| +++ b/chrome/browser/resources/gaia_auth_host/authenticator.js |
| @@ -125,11 +125,29 @@ cr.define('cr.login', function() { |
| Authenticator.prototype = Object.create(cr.EventTarget.prototype); |
| /** |
| + * Reinitializes authentication parameters so that a failed login attempt |
| + * would not result in an infinite loop. |
| + */ |
| + Authenticator.prototype.clearCredentials_ = function() { |
|
Roman Sorokin (ftl)
2015/03/17 17:00:41
Could we call this function in the constructor? We
Ivan Podogov
2015/03/18 07:36:20
That was my initial thought, but Dmitry asked me t
|
| + this.email_ = null; |
| + this.gaiaId_ = null; |
| + this.password_ = null; |
| + this.oauth_code_ = null; |
| + this.chooseWhatToSync_ = false; |
| + this.skipForNow_ = false; |
| + this.sessionIndex_ = null; |
| + this.trusted_ = true; |
| + this.authFlow_ = AuthFlow.DEFAULT; |
| + this.loaded_ = false; |
| + }; |
| + |
| + /** |
| * Loads the authenticator component with the given parameters. |
| * @param {AuthMode} authMode Authorization mode. |
| * @param {Object} data Parameters for the authorization flow. |
| */ |
| Authenticator.prototype.load = function(authMode, data) { |
| + this.clearCredentials_(); |
| this.idpOrigin_ = data.gaiaUrl || IDP_ORIGIN; |
| this.continueUrl_ = data.continueUrl || CONTINUE_URL; |
| this.continueUrlWithoutParams_ = |
| @@ -140,20 +158,16 @@ cr.define('cr.login', function() { |
| this.initialFrameUrl_ = this.constructInitialFrameUrl_(data); |
| this.reloadUrl_ = data.frameUrl || this.initialFrameUrl_; |
| - this.authFlow_ = AuthFlow.DEFAULT; |
| this.webview_.src = this.reloadUrl_; |
| - |
| - this.loaded_ = false; |
| }; |
| /** |
| * Reloads the authenticator component. |
| */ |
| Authenticator.prototype.reload = function() { |
| + this.clearCredentials_(); |
| this.webview_.src = this.reloadUrl_; |
| - this.authFlow_ = AuthFlow.DEFAULT; |
| - this.loaded_ = false; |
| }; |
| Authenticator.prototype.constructInitialFrameUrl_ = function(data) { |