Chromium Code Reviews| Index: chrome/browser/resources/chromeos/login/oobe_screen_oauth_enrollment.js |
| diff --git a/chrome/browser/resources/chromeos/login/oobe_screen_oauth_enrollment.js b/chrome/browser/resources/chromeos/login/oobe_screen_oauth_enrollment.js |
| index 1a5a588aeaf2b0218fe2de5ed184d2afa10753ce..de7966940eeb576e73e2811cccb78f4b945e10f7 100644 |
| --- a/chrome/browser/resources/chromeos/login/oobe_screen_oauth_enrollment.js |
| +++ b/chrome/browser/resources/chromeos/login/oobe_screen_oauth_enrollment.js |
| @@ -11,6 +11,7 @@ login.createScreen('OAuthEnrollmentScreen', 'oauth-enrollment', function() { |
| })();`; |
| /** @const */ var STEP_SIGNIN = 'signin'; |
| + /** @const */ var STEP_AD_JOIN = 'ad-join'; |
| /** @const */ var STEP_WORKING = 'working'; |
| /** @const */ var STEP_ATTRIBUTE_PROMPT = 'attribute-prompt'; |
| /** @const */ var STEP_ERROR = 'error'; |
| @@ -29,6 +30,7 @@ login.createScreen('OAuthEnrollmentScreen', 'oauth-enrollment', function() { |
| 'doReload', |
| 'showAttributePromptStep', |
| 'showAttestationBasedEnrollmentSuccess', |
| + 'invalidateAD', |
| ], |
| /** |
| @@ -60,6 +62,13 @@ login.createScreen('OAuthEnrollmentScreen', 'oauth-enrollment', function() { |
| navigation_: undefined, |
| /** |
| + * An element containing UI to join an AD domain. |
| + * @type {OfflineAdLoginElement} |
| + * @private |
| + */ |
| + offlineAdUi_: undefined, |
| + |
| + /** |
| * Value contained in the last received 'backButton' event. |
| * @type {boolean} |
| * @private |
| @@ -69,6 +78,7 @@ login.createScreen('OAuthEnrollmentScreen', 'oauth-enrollment', function() { |
| /** @override */ |
| decorate: function() { |
| this.navigation_ = $('oauth-enroll-navigation'); |
| + this.offlineAdUi_ = $('oauth-enroll-ad-join-ui'); |
| this.authenticator_ = |
| new cr.login.Authenticator($('oauth-enroll-auth-view')); |
| @@ -112,6 +122,12 @@ login.createScreen('OAuthEnrollmentScreen', 'oauth-enrollment', function() { |
| detail.authCode]); |
| }).bind(this)); |
| + this.offlineAdUi_.addEventListener('authCompleted', function(e) { |
| + this.offlineAdUi_.disabled = true; |
| + chrome.send('oauthEnrollADCompleteLogin', |
| + [e.detail.machinename, e.detail.username, e.detail.password]); |
| + }.bind(this)); |
| + |
| this.authenticator_.addEventListener('authFlowChange', |
| (function(e) { |
| var isSAML = this.authenticator_.authFlow == |
| @@ -167,7 +183,8 @@ login.createScreen('OAuthEnrollmentScreen', 'oauth-enrollment', function() { |
| this.navigation_.addEventListener('back', function() { |
| this.navigation_.backVisible = false; |
| - $('oauth-enroll-auth-view').back(); |
| + if (this.currentStep_ == STEP_SIGNIN) |
| + $('oauth-enroll-auth-view').back(); |
| }.bind(this)); |
| $('oauth-enroll-attribute-prompt-card').addEventListener('submit', |
| @@ -294,6 +311,9 @@ login.createScreen('OAuthEnrollmentScreen', 'oauth-enrollment', function() { |
| $('oauth-enroll-asset-id').focus(); |
| } else if (step == STEP_ATTRIBUTE_PROMPT_ERROR) { |
| $('oauth-enroll-attribute-prompt-error-card').submitButton.focus(); |
| + } else if (step == STEP_AD_JOIN) { |
| + this.offlineAdUi_.disabled = false; |
| + this.offlineAdUi_.setUser(); |
| } |
| this.currentStep_ = step; |
| @@ -325,6 +345,11 @@ login.createScreen('OAuthEnrollmentScreen', 'oauth-enrollment', function() { |
| this.updateControlsState(); |
| }, |
| + invalidateAD: function(machineName, user) { |
| + this.offlineAdUi_.disabled = false; |
|
michaelpg
2016/11/02 23:08:53
nit (throughout): can you decide whether you want
Roman Sorokin (ftl)
2016/11/03 14:03:46
Done.
michaelpg
2016/11/04 00:34:21
thanks. Makes the code easier to modify when you d
|
| + this.offlineAdUi_.setUser(user, machineName); |
| + }, |
| + |
| /** |
| * Retries the enrollment process after an error occurred in a previous |
| * attempt. This goes to the C++ side through |chrome| first to clean up the |
| @@ -371,7 +396,8 @@ login.createScreen('OAuthEnrollmentScreen', 'oauth-enrollment', function() { |
| this.navigation_.refreshVisible = this.isAtTheBeginning() && |
| !this.isManualEnrollment_; |
| this.navigation_.closeVisible = (this.currentStep_ == STEP_SIGNIN || |
| - this.currentStep_ == STEP_ERROR) && |
| + this.currentStep_ == STEP_ERROR || |
| + this.currentStep_ == STEP_AD_JOIN) && |
| !this.navigation_.refreshVisible; |
| $('login-header-bar').updateUI_(); |
| } |