OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 /** | 5 /** |
6 * @fileoverview Oobe signin screen implementation. | 6 * @fileoverview Oobe signin screen implementation. |
7 */ | 7 */ |
8 | 8 |
9 login.createScreen('GaiaSigninScreen', 'gaia-signin', function() { | 9 login.createScreen('GaiaSigninScreen', 'gaia-signin', function() { |
10 // GAIA animation guard timer. Started when GAIA page is loaded | 10 // GAIA animation guard timer. Started when GAIA page is loaded |
(...skipping 19 matching lines...) Expand all Loading... |
30 // Amount of time allowed for video based SAML logins, to prevent a site | 30 // Amount of time allowed for video based SAML logins, to prevent a site |
31 // from keeping the camera on indefinitely. This is a hard deadline and | 31 // from keeping the camera on indefinitely. This is a hard deadline and |
32 // it will not be extended by user activity. | 32 // it will not be extended by user activity. |
33 /** @const */ var VIDEO_LOGIN_TIMEOUT = 90 * 1000; | 33 /** @const */ var VIDEO_LOGIN_TIMEOUT = 90 * 1000; |
34 | 34 |
35 /** | 35 /** |
36 * The modes this screen can be in. | 36 * The modes this screen can be in. |
37 * @enum {integer} | 37 * @enum {integer} |
38 */ | 38 */ |
39 var ScreenMode = { | 39 var ScreenMode = { |
40 DEFAULT: 0, // Default GAIA login flow. | 40 DEFAULT: 0, // Default GAIA login flow. |
41 OFFLINE: 1, // GAIA offline login. | 41 OFFLINE: 1, // GAIA offline login. |
42 SAML_INTERSTITIAL: 2, // Interstitial page before SAML redirection. | 42 SAML_INTERSTITIAL: 2, // Interstitial page before SAML redirection. |
43 AD_AUTH: 3 // Offline Active Directory login flow. | 43 AD_AUTH: 3 // Offline Active Directory login flow. |
44 }; | 44 }; |
45 | 45 |
46 return { | 46 return { |
47 EXTERNAL_API: [ | 47 EXTERNAL_API: [ |
48 'loadAuthExtension', | 48 'loadAuthExtension', |
49 'doReload', | 49 'doReload', |
50 'monitorOfflineIdle', | 50 'monitorOfflineIdle', |
51 'updateControlsState', | 51 'updateControlsState', |
52 'showWhitelistCheckFailedError', | 52 'showWhitelistCheckFailedError', |
53 'invalidateAd', | 53 'invalidateAd', |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 */ | 123 */ |
124 get closable() { | 124 get closable() { |
125 return !!$('pod-row').pods.length || this.isOffline(); | 125 return !!$('pod-row').pods.length || this.isOffline(); |
126 }, | 126 }, |
127 | 127 |
128 /** | 128 /** |
129 * Returns true if GAIA is at the begging of flow (i.e. the email page). | 129 * Returns true if GAIA is at the begging of flow (i.e. the email page). |
130 * @type {boolean} | 130 * @type {boolean} |
131 */ | 131 */ |
132 isAtTheBeginning: function() { | 132 isAtTheBeginning: function() { |
133 return !this.navigation_.backVisible && | 133 return !this.navigation_.backVisible && !this.isSAML() && |
134 !this.isSAML() && | 134 !this.classList.contains('whitelist-error') && !this.authCompleted_; |
135 !this.classList.contains('whitelist-error') && | |
136 !this.authCompleted_; | |
137 }, | 135 }, |
138 | 136 |
139 /** | 137 /** |
140 * Updates visibility of navigation buttons. | 138 * Updates visibility of navigation buttons. |
141 */ | 139 */ |
142 updateControlsState: function() { | 140 updateControlsState: function() { |
143 var isWhitelistError = this.classList.contains('whitelist-error'); | 141 var isWhitelistError = this.classList.contains('whitelist-error'); |
144 | 142 |
145 this.navigation_.backVisible = | 143 this.navigation_.backVisible = this.lastBackMessageValue_ && |
146 this.lastBackMessageValue_ && | 144 !isWhitelistError && !this.authCompleted_ && !this.loading && |
147 !isWhitelistError && | 145 !this.isSAML(); |
148 !this.authCompleted_ && | |
149 !this.loading && | |
150 !this.isSAML(); | |
151 | 146 |
152 this.navigation_.refreshVisible = | 147 this.navigation_.refreshVisible = !this.closable && |
153 !this.closable && this.isAtTheBeginning() && | 148 this.isAtTheBeginning() && |
154 this.screenMode_ != ScreenMode.SAML_INTERSTITIAL; | 149 this.screenMode_ != ScreenMode.SAML_INTERSTITIAL; |
155 | 150 |
156 this.navigation_.closeVisible = | 151 this.navigation_.closeVisible = !this.navigation_.refreshVisible && |
157 !this.navigation_.refreshVisible && | 152 !isWhitelistError && !this.authCompleted_ && |
158 !isWhitelistError && | 153 this.screenMode_ != ScreenMode.SAML_INTERSTITIAL; |
159 !this.authCompleted_ && | |
160 this.screenMode_ != ScreenMode.SAML_INTERSTITIAL; | |
161 | 154 |
162 $('login-header-bar').updateUI_(); | 155 $('login-header-bar').updateUI_(); |
163 }, | 156 }, |
164 | 157 |
165 /** | 158 /** |
166 * SAML password confirmation attempt count. | 159 * SAML password confirmation attempt count. |
167 * @type {number} | 160 * @type {number} |
168 */ | 161 */ |
169 samlPasswordConfirmAttempt_: 0, | 162 samlPasswordConfirmAttempt_: 0, |
170 | 163 |
(...skipping 17 matching lines...) Expand all Loading... |
188 | 181 |
189 /** @override */ | 182 /** @override */ |
190 decorate: function() { | 183 decorate: function() { |
191 this.navigation_ = $('gaia-navigation'); | 184 this.navigation_ = $('gaia-navigation'); |
192 | 185 |
193 this.gaiaAuthHost_ = new cr.login.GaiaAuthHost($('signin-frame')); | 186 this.gaiaAuthHost_ = new cr.login.GaiaAuthHost($('signin-frame')); |
194 this.gaiaAuthHost_.addEventListener( | 187 this.gaiaAuthHost_.addEventListener( |
195 'ready', this.onAuthReady_.bind(this)); | 188 'ready', this.onAuthReady_.bind(this)); |
196 | 189 |
197 var that = this; | 190 var that = this; |
198 [this.gaiaAuthHost_, $('offline-gaia'), $('offline-ad-auth')]. | 191 [this.gaiaAuthHost_, $('offline-gaia'), $('offline-ad-auth')].forEach( |
199 forEach(function(frame) { | 192 function(frame) { |
200 // Ignore events from currently inactive frame. | 193 // Ignore events from currently inactive frame. |
201 var frameFilter = function(callback) { | 194 var frameFilter = function(callback) { |
202 return function(e) { | 195 return function(e) { |
203 var currentFrame = null; | 196 var currentFrame = null; |
204 switch (that.screenMode_) { | 197 switch (that.screenMode_) { |
205 case ScreenMode.DEFAULT: | 198 case ScreenMode.DEFAULT: |
206 case ScreenMode.SAML_INTERSTITIAL: | 199 case ScreenMode.SAML_INTERSTITIAL: |
207 currentFrame = that.gaiaAuthHost_; | 200 currentFrame = that.gaiaAuthHost_; |
208 break; | 201 break; |
209 case ScreenMode.OFFLINE: | 202 case ScreenMode.OFFLINE: |
210 currentFrame = $('offline-gaia'); | 203 currentFrame = $('offline-gaia'); |
211 break; | 204 break; |
212 case ScreenMode.AD_AUTH: | 205 case ScreenMode.AD_AUTH: |
213 currentFrame = $('offline-ad-auth'); | 206 currentFrame = $('offline-ad-auth'); |
214 break; | 207 break; |
215 } | 208 } |
216 if (frame === currentFrame) | 209 if (frame === currentFrame) |
217 callback.call(that, e); | 210 callback.call(that, e); |
218 }; | 211 }; |
219 }; | 212 }; |
220 | 213 |
221 frame.addEventListener('authCompleted', | 214 frame.addEventListener( |
222 frameFilter(that.onAuthCompletedMessage_)); | 215 'authCompleted', frameFilter(that.onAuthCompletedMessage_)); |
223 frame.addEventListener('backButton', frameFilter(that.onBackButton_)); | 216 frame.addEventListener( |
224 frame.addEventListener('dialogShown', frameFilter(that.onDialogShown_)); | 217 'backButton', frameFilter(that.onBackButton_)); |
225 frame.addEventListener('dialogHidden', | 218 frame.addEventListener( |
226 frameFilter(that.onDialogHidden_)); | 219 'dialogShown', frameFilter(that.onDialogShown_)); |
227 }); | 220 frame.addEventListener( |
| 221 'dialogHidden', frameFilter(that.onDialogHidden_)); |
| 222 }); |
228 | 223 |
229 this.gaiaAuthHost_.addEventListener( | 224 this.gaiaAuthHost_.addEventListener( |
230 'showView', this.onShowView_.bind(this)); | 225 'showView', this.onShowView_.bind(this)); |
231 this.gaiaAuthHost_.confirmPasswordCallback = | 226 this.gaiaAuthHost_.confirmPasswordCallback = |
232 this.onAuthConfirmPassword_.bind(this); | 227 this.onAuthConfirmPassword_.bind(this); |
233 this.gaiaAuthHost_.noPasswordCallback = | 228 this.gaiaAuthHost_.noPasswordCallback = this.onAuthNoPassword_.bind(this); |
234 this.onAuthNoPassword_.bind(this); | |
235 this.gaiaAuthHost_.insecureContentBlockedCallback = | 229 this.gaiaAuthHost_.insecureContentBlockedCallback = |
236 this.onInsecureContentBlocked_.bind(this); | 230 this.onInsecureContentBlocked_.bind(this); |
237 this.gaiaAuthHost_.missingGaiaInfoCallback = | 231 this.gaiaAuthHost_.missingGaiaInfoCallback = |
238 this.missingGaiaInfo_.bind(this); | 232 this.missingGaiaInfo_.bind(this); |
239 this.gaiaAuthHost_.samlApiUsedCallback = | 233 this.gaiaAuthHost_.samlApiUsedCallback = this.samlApiUsed_.bind(this); |
240 this.samlApiUsed_.bind(this); | 234 this.gaiaAuthHost_.addEventListener( |
241 this.gaiaAuthHost_.addEventListener('authDomainChange', | 235 'authDomainChange', this.onAuthDomainChange_.bind(this)); |
242 this.onAuthDomainChange_.bind(this)); | 236 this.gaiaAuthHost_.addEventListener( |
243 this.gaiaAuthHost_.addEventListener('authFlowChange', | 237 'authFlowChange', this.onAuthFlowChange_.bind(this)); |
244 this.onAuthFlowChange_.bind(this)); | 238 this.gaiaAuthHost_.addEventListener( |
245 this.gaiaAuthHost_.addEventListener('videoEnabledChange', | 239 'videoEnabledChange', this.onVideoEnabledChange_.bind(this)); |
246 this.onVideoEnabledChange_.bind(this)); | |
247 | 240 |
248 this.gaiaAuthHost_.addEventListener('loadAbort', | 241 this.gaiaAuthHost_.addEventListener( |
249 this.onLoadAbortMessage_.bind(this)); | 242 'loadAbort', this.onLoadAbortMessage_.bind(this)); |
250 this.gaiaAuthHost_.addEventListener( | 243 this.gaiaAuthHost_.addEventListener( |
251 'identifierEntered', this.onIdentifierEnteredMessage_.bind(this)); | 244 'identifierEntered', this.onIdentifierEnteredMessage_.bind(this)); |
252 | 245 |
253 this.navigation_.addEventListener('back', function() { | 246 this.navigation_.addEventListener('back', function() { |
254 this.navigation_.backVisible = false; | 247 this.navigation_.backVisible = false; |
255 this.getSigninFrame_().back(); | 248 this.getSigninFrame_().back(); |
256 }.bind(this)); | 249 }.bind(this)); |
257 | 250 |
258 this.navigation_.addEventListener('close', function() { | 251 this.navigation_.addEventListener('close', function() { |
259 this.cancel(); | 252 this.cancel(); |
260 }.bind(this)); | 253 }.bind(this)); |
261 this.navigation_.addEventListener('refresh', function() { | 254 this.navigation_.addEventListener('refresh', function() { |
262 this.cancel(); | 255 this.cancel(); |
263 }.bind(this)); | 256 }.bind(this)); |
264 | 257 |
265 $('gaia-whitelist-error').addEventListener('buttonclick', function() { | 258 $('gaia-whitelist-error').addEventListener('buttonclick', function() { |
266 this.showWhitelistCheckFailedError(false); | 259 this.showWhitelistCheckFailedError(false); |
267 }.bind(this)); | 260 }.bind(this)); |
268 | 261 |
269 $('gaia-whitelist-error').addEventListener('linkclick', function() { | 262 $('gaia-whitelist-error').addEventListener('linkclick', function() { |
270 chrome.send('launchHelpApp', [HELP_CANT_ACCESS_ACCOUNT]); | 263 chrome.send('launchHelpApp', [HELP_CANT_ACCESS_ACCOUNT]); |
271 }); | 264 }); |
272 | 265 |
273 // Register handlers for the saml interstitial page events. | 266 // Register handlers for the saml interstitial page events. |
274 $('saml-interstitial').addEventListener('samlPageNextClicked', | 267 $('saml-interstitial') |
275 function() { | 268 .addEventListener('samlPageNextClicked', function() { |
276 this.screenMode = ScreenMode.DEFAULT; | 269 this.screenMode = ScreenMode.DEFAULT; |
277 this.loadGaiaAuthHost_(true /* doSamlRedirect */); | 270 this.loadGaiaAuthHost_(true /* doSamlRedirect */); |
278 }.bind(this)); | 271 }.bind(this)); |
279 $('saml-interstitial').addEventListener('samlPageChangeAccountClicked', | 272 $('saml-interstitial') |
280 function() { | 273 .addEventListener('samlPageChangeAccountClicked', function() { |
281 // The user requests to change the account. We must clear the email | 274 // The user requests to change the account. We must clear the email |
282 // field of the auth params. | 275 // field of the auth params. |
283 this.gaiaAuthParams_.email = ''; | 276 this.gaiaAuthParams_.email = ''; |
284 this.screenMode = ScreenMode.DEFAULT; | 277 this.screenMode = ScreenMode.DEFAULT; |
285 this.loadGaiaAuthHost_(false /* doSamlRedirect */); | 278 this.loadGaiaAuthHost_(false /* doSamlRedirect */); |
286 }.bind(this)); | 279 }.bind(this)); |
287 }, | 280 }, |
288 | 281 |
289 /** | 282 /** |
290 * Loads the authenticator and updates the UI to reflect the loading state. | 283 * Loads the authenticator and updates the UI to reflect the loading state. |
291 * @param {boolean} doSamlRedirect If the authenticator should do | 284 * @param {boolean} doSamlRedirect If the authenticator should do |
292 * authentication by automatic redirection to the SAML-based enrollment | 285 * authentication by automatic redirection to the SAML-based enrollment |
293 * enterprise domain IdP. | 286 * enterprise domain IdP. |
294 */ | 287 */ |
295 loadGaiaAuthHost_: function(doSamlRedirect) { | 288 loadGaiaAuthHost_: function(doSamlRedirect) { |
296 this.loading = true; | 289 this.loading = true; |
297 this.startLoadingTimer_(); | 290 this.startLoadingTimer_(); |
298 | 291 |
299 this.gaiaAuthParams_.doSamlRedirect = doSamlRedirect; | 292 this.gaiaAuthParams_.doSamlRedirect = doSamlRedirect; |
300 this.gaiaAuthHost_.load(cr.login.GaiaAuthHost.AuthMode.DEFAULT, | 293 this.gaiaAuthHost_.load( |
301 this.gaiaAuthParams_); | 294 cr.login.GaiaAuthHost.AuthMode.DEFAULT, this.gaiaAuthParams_); |
302 }, | 295 }, |
303 | 296 |
304 /** | 297 /** |
305 * Header text of the screen. | 298 * Header text of the screen. |
306 * @type {string} | 299 * @type {string} |
307 */ | 300 */ |
308 get header() { | 301 get header() { |
309 return loadTimeData.getString('signinScreenTitle'); | 302 return loadTimeData.getString('signinScreenTitle'); |
310 }, | 303 }, |
311 | 304 |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
465 this.loadingTimer_ = undefined; | 458 this.loadingTimer_ = undefined; |
466 } | 459 } |
467 }, | 460 }, |
468 | 461 |
469 /** | 462 /** |
470 * Sets up loading timer. | 463 * Sets up loading timer. |
471 * @private | 464 * @private |
472 */ | 465 */ |
473 startLoadingTimer_: function() { | 466 startLoadingTimer_: function() { |
474 this.clearLoadingTimer_(); | 467 this.clearLoadingTimer_(); |
475 this.loadingTimer_ = setTimeout(this.onLoadingTimeOut_.bind(this), | 468 this.loadingTimer_ = setTimeout( |
476 MAX_GAIA_LOADING_TIME_SEC * 1000); | 469 this.onLoadingTimeOut_.bind(this), MAX_GAIA_LOADING_TIME_SEC * 1000); |
477 }, | 470 }, |
478 | 471 |
479 /** | 472 /** |
480 * Handler for GAIA animation guard timer. | 473 * Handler for GAIA animation guard timer. |
481 * @private | 474 * @private |
482 */ | 475 */ |
483 onLoadAnimationGuardTimer_: function() { | 476 onLoadAnimationGuardTimer_: function() { |
484 this.loadAnimationGuardTimer_ = undefined; | 477 this.loadAnimationGuardTimer_ = undefined; |
485 this.onShowView_(); | 478 this.onShowView_(); |
486 }, | 479 }, |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
645 break; | 638 break; |
646 } | 639 } |
647 this.updateControlsState(); | 640 this.updateControlsState(); |
648 chrome.send('authExtensionLoaded'); | 641 chrome.send('authExtensionLoaded'); |
649 }, | 642 }, |
650 | 643 |
651 /** | 644 /** |
652 * Whether the current auth flow is SAML. | 645 * Whether the current auth flow is SAML. |
653 */ | 646 */ |
654 isSAML: function() { | 647 isSAML: function() { |
655 return this.gaiaAuthHost_.authFlow == | 648 return this.gaiaAuthHost_.authFlow == cr.login.GaiaAuthHost.AuthFlow.SAML; |
656 cr.login.GaiaAuthHost.AuthFlow.SAML; | |
657 }, | 649 }, |
658 | 650 |
659 /** | 651 /** |
660 * Helper function to update the title bar. | 652 * Helper function to update the title bar. |
661 */ | 653 */ |
662 updateSamlNotice_: function() { | 654 updateSamlNotice_: function() { |
663 if (this.gaiaAuthHost_.videoEnabled) { | 655 if (this.gaiaAuthHost_.videoEnabled) { |
664 $('saml-notice-message').textContent = loadTimeData.getStringF( | 656 $('saml-notice-message').textContent = loadTimeData.getStringF( |
665 'samlNoticeWithVideo', | 657 'samlNoticeWithVideo', this.gaiaAuthHost_.authDomain); |
666 this.gaiaAuthHost_.authDomain); | |
667 $('saml-notice-recording-indicator').hidden = false; | 658 $('saml-notice-recording-indicator').hidden = false; |
668 $('saml-notice-container').style.justifyContent = 'flex-start'; | 659 $('saml-notice-container').style.justifyContent = 'flex-start'; |
669 } else { | 660 } else { |
670 $('saml-notice-message').textContent = loadTimeData.getStringF( | 661 $('saml-notice-message').textContent = loadTimeData.getStringF( |
671 'samlNotice', | 662 'samlNotice', this.gaiaAuthHost_.authDomain); |
672 this.gaiaAuthHost_.authDomain); | |
673 $('saml-notice-recording-indicator').hidden = true; | 663 $('saml-notice-recording-indicator').hidden = true; |
674 $('saml-notice-container').style.justifyContent = 'center'; | 664 $('saml-notice-container').style.justifyContent = 'center'; |
675 } | 665 } |
676 }, | 666 }, |
677 | 667 |
678 /** | 668 /** |
679 * Clean up from a video-enabled SAML flow. | 669 * Clean up from a video-enabled SAML flow. |
680 */ | 670 */ |
681 clearVideoTimer_: function() { | 671 clearVideoTimer_: function() { |
682 if (this.videoTimer_ !== undefined) { | 672 if (this.videoTimer_ !== undefined) { |
683 clearTimeout(this.videoTimer_); | 673 clearTimeout(this.videoTimer_); |
684 this.videoTimer_ = undefined; | 674 this.videoTimer_ = undefined; |
685 } | 675 } |
686 }, | 676 }, |
687 | 677 |
688 /** | 678 /** |
689 * Invoked when the authDomain property is changed on the GAIA host. | 679 * Invoked when the authDomain property is changed on the GAIA host. |
690 */ | 680 */ |
691 onAuthDomainChange_: function() { | 681 onAuthDomainChange_: function() { |
692 this.updateSamlNotice_(); | 682 this.updateSamlNotice_(); |
693 }, | 683 }, |
694 | 684 |
695 /** | 685 /** |
696 * Invoked when the videoEnabled property is changed on the GAIA host. | 686 * Invoked when the videoEnabled property is changed on the GAIA host. |
697 */ | 687 */ |
698 onVideoEnabledChange_: function() { | 688 onVideoEnabledChange_: function() { |
699 this.updateSamlNotice_(); | 689 this.updateSamlNotice_(); |
700 if (this.gaiaAuthHost_.videoEnabled && this.videoTimer_ === undefined) { | 690 if (this.gaiaAuthHost_.videoEnabled && this.videoTimer_ === undefined) { |
701 this.videoTimer_ = setTimeout(this.cancel.bind(this), | 691 this.videoTimer_ = |
702 VIDEO_LOGIN_TIMEOUT); | 692 setTimeout(this.cancel.bind(this), VIDEO_LOGIN_TIMEOUT); |
703 } else { | 693 } else { |
704 this.clearVideoTimer_(); | 694 this.clearVideoTimer_(); |
705 } | 695 } |
706 }, | 696 }, |
707 | 697 |
708 /** | 698 /** |
709 * Invoked when the authFlow property is changed on the GAIA host. | 699 * Invoked when the authFlow property is changed on the GAIA host. |
710 */ | 700 */ |
711 onAuthFlowChange_: function() { | 701 onAuthFlowChange_: function() { |
712 var isSAML = this.isSAML(); | 702 var isSAML = this.isSAML(); |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
804 */ | 794 */ |
805 onAuthConfirmPassword_: function(email, passwordCount) { | 795 onAuthConfirmPassword_: function(email, passwordCount) { |
806 this.loading = true; | 796 this.loading = true; |
807 Oobe.getInstance().headerHidden = false; | 797 Oobe.getInstance().headerHidden = false; |
808 | 798 |
809 if (this.samlPasswordConfirmAttempt_ == 0) | 799 if (this.samlPasswordConfirmAttempt_ == 0) |
810 chrome.send('scrapedPasswordCount', [passwordCount]); | 800 chrome.send('scrapedPasswordCount', [passwordCount]); |
811 | 801 |
812 if (this.samlPasswordConfirmAttempt_ < 2) { | 802 if (this.samlPasswordConfirmAttempt_ < 2) { |
813 login.ConfirmPasswordScreen.show( | 803 login.ConfirmPasswordScreen.show( |
814 email, | 804 email, false /* manual password entry */, |
815 false /* manual password entry */, | |
816 this.samlPasswordConfirmAttempt_, | 805 this.samlPasswordConfirmAttempt_, |
817 this.onConfirmPasswordCollected_.bind(this)); | 806 this.onConfirmPasswordCollected_.bind(this)); |
818 } else { | 807 } else { |
819 chrome.send('scrapedPasswordVerificationFailed'); | 808 chrome.send('scrapedPasswordVerificationFailed'); |
820 this.showFatalAuthError( | 809 this.showFatalAuthError( |
821 loadTimeData.getString('fatalErrorMessageVerificationFailed'), | 810 loadTimeData.getString('fatalErrorMessageVerificationFailed'), |
822 loadTimeData.getString('fatalErrorTryAgainButton')); | 811 loadTimeData.getString('fatalErrorTryAgainButton')); |
823 } | 812 } |
824 this.classList.toggle('full-width', false); | 813 this.classList.toggle('full-width', false); |
825 }, | 814 }, |
(...skipping 12 matching lines...) Expand all Loading... |
838 | 827 |
839 /** | 828 /** |
840 * Inovked when the user has successfully authenticated via SAML, the | 829 * Inovked when the user has successfully authenticated via SAML, the |
841 * principals API was not used and no passwords could be scraped. | 830 * principals API was not used and no passwords could be scraped. |
842 * The user will be asked to pick a manual password for the device. | 831 * The user will be asked to pick a manual password for the device. |
843 * @param {string} email The authenticated user's e-mail. | 832 * @param {string} email The authenticated user's e-mail. |
844 */ | 833 */ |
845 onAuthNoPassword_: function(email) { | 834 onAuthNoPassword_: function(email) { |
846 chrome.send('scrapedPasswordCount', [0]); | 835 chrome.send('scrapedPasswordCount', [0]); |
847 login.ConfirmPasswordScreen.show( | 836 login.ConfirmPasswordScreen.show( |
848 email, | 837 email, true /* manual password entry */, |
849 true /* manual password entry */, | |
850 this.samlPasswordConfirmAttempt_, | 838 this.samlPasswordConfirmAttempt_, |
851 this.onManualPasswordCollected_.bind(this)); | 839 this.onManualPasswordCollected_.bind(this)); |
852 }, | 840 }, |
853 | 841 |
854 /** | 842 /** |
855 * Invoked when the dialog where the user enters a manual password for the | 843 * Invoked when the dialog where the user enters a manual password for the |
856 * device, when password scraping fails. | 844 * device, when password scraping fails. |
857 * @param {string} password The password the user entered. Not necessarily | 845 * @param {string} password The password the user entered. Not necessarily |
858 * the same as their SAML password. | 846 * the same as their SAML password. |
859 */ | 847 */ |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
900 }, | 888 }, |
901 | 889 |
902 /** | 890 /** |
903 * Invoked when auth is completed successfully. | 891 * Invoked when auth is completed successfully. |
904 * @param {!Object} credentials Credentials of the completed authentication. | 892 * @param {!Object} credentials Credentials of the completed authentication. |
905 * @private | 893 * @private |
906 */ | 894 */ |
907 onAuthCompleted_: function(credentials) { | 895 onAuthCompleted_: function(credentials) { |
908 if (this.screenMode_ == ScreenMode.AD_AUTH) { | 896 if (this.screenMode_ == ScreenMode.AD_AUTH) { |
909 this.email = credentials.username; | 897 this.email = credentials.username; |
910 chrome.send('completeAdAuthentication', | 898 chrome.send( |
911 [credentials.username, | 899 'completeAdAuthentication', |
912 credentials.password]); | 900 [credentials.username, credentials.password]); |
913 } else if (credentials.useOffline) { | 901 } else if (credentials.useOffline) { |
914 this.email = credentials.email; | 902 this.email = credentials.email; |
915 chrome.send('authenticateUser', | 903 chrome.send( |
916 [credentials.email, | 904 'authenticateUser', |
917 credentials.password, | 905 [credentials.email, credentials.password, false]); |
918 false]); | |
919 } else if (credentials.authCode) { | 906 } else if (credentials.authCode) { |
920 if (credentials.hasOwnProperty('authCodeOnly') && | 907 if (credentials.hasOwnProperty('authCodeOnly') && |
921 credentials.authCodeOnly) { | 908 credentials.authCodeOnly) { |
922 chrome.send('completeAuthenticationAuthCodeOnly', | 909 chrome.send( |
923 [credentials.authCode]); | 910 'completeAuthenticationAuthCodeOnly', [credentials.authCode]); |
924 } else { | 911 } else { |
925 chrome.send('completeAuthentication', [ | 912 chrome.send('completeAuthentication', [ |
926 credentials.gaiaId, | 913 credentials.gaiaId, credentials.email, credentials.password, |
927 credentials.email, | 914 credentials.authCode, credentials.usingSAML, credentials.gapsCookie |
928 credentials.password, | |
929 credentials.authCode, | |
930 credentials.usingSAML, | |
931 credentials.gapsCookie | |
932 ]); | 915 ]); |
933 } | 916 } |
934 } else { | 917 } else { |
935 chrome.send('completeLogin', | 918 chrome.send('completeLogin', [ |
936 [credentials.gaiaId, | 919 credentials.gaiaId, credentials.email, credentials.password, |
937 credentials.email, | 920 credentials.usingSAML |
938 credentials.password, | 921 ]); |
939 credentials.usingSAML]); | |
940 } | 922 } |
941 | 923 |
942 this.loading = true; | 924 this.loading = true; |
943 | 925 |
944 // Now that we're in logged in state header should be hidden. | 926 // Now that we're in logged in state header should be hidden. |
945 Oobe.getInstance().headerHidden = true; | 927 Oobe.getInstance().headerHidden = true; |
946 // Clear any error messages that were shown before login. | 928 // Clear any error messages that were shown before login. |
947 Oobe.clearErrors(); | 929 Oobe.clearErrors(); |
948 | 930 |
949 this.clearVideoTimer_(); | 931 this.clearVideoTimer_(); |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1020 * @param {HTMLElement} content Content to show in bubble. | 1002 * @param {HTMLElement} content Content to show in bubble. |
1021 */ | 1003 */ |
1022 showErrorBubble: function(loginAttempts, error) { | 1004 showErrorBubble: function(loginAttempts, error) { |
1023 if (this.isOffline()) { | 1005 if (this.isOffline()) { |
1024 $('add-user-button').hidden = true; | 1006 $('add-user-button').hidden = true; |
1025 // Reload offline version of the sign-in extension, which will show | 1007 // Reload offline version of the sign-in extension, which will show |
1026 // error itself. | 1008 // error itself. |
1027 chrome.send('offlineLogin', [this.email]); | 1009 chrome.send('offlineLogin', [this.email]); |
1028 } else if (!this.loading) { | 1010 } else if (!this.loading) { |
1029 // TODO(dzhioev): investigate if this branch ever get hit. | 1011 // TODO(dzhioev): investigate if this branch ever get hit. |
1030 $('bubble').showContentForElement($('gaia-signin-form-container'), | 1012 $('bubble').showContentForElement( |
1031 cr.ui.Bubble.Attachment.LEFT, | 1013 $('gaia-signin-form-container'), cr.ui.Bubble.Attachment.LEFT, |
1032 error); | 1014 error); |
1033 } else { | 1015 } else { |
1034 // Defer the bubble until the frame has been loaded. | 1016 // Defer the bubble until the frame has been loaded. |
1035 this.errorBubble_ = [loginAttempts, error]; | 1017 this.errorBubble_ = [loginAttempts, error]; |
1036 } | 1018 } |
1037 }, | 1019 }, |
1038 | 1020 |
1039 /** | 1021 /** |
1040 * Called when user canceled signin. | 1022 * Called when user canceled signin. |
1041 */ | 1023 */ |
1042 cancel: function() { | 1024 cancel: function() { |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1103 | 1085 |
1104 /** | 1086 /** |
1105 * Show/Hide error when user is not in whitelist. When UI is hidden | 1087 * Show/Hide error when user is not in whitelist. When UI is hidden |
1106 * GAIA is reloaded. | 1088 * GAIA is reloaded. |
1107 * @param {boolean} show Show/hide error UI. | 1089 * @param {boolean} show Show/hide error UI. |
1108 * @param {!Object} opt_data Optional additional information. | 1090 * @param {!Object} opt_data Optional additional information. |
1109 */ | 1091 */ |
1110 showWhitelistCheckFailedError: function(show, opt_data) { | 1092 showWhitelistCheckFailedError: function(show, opt_data) { |
1111 if (show) { | 1093 if (show) { |
1112 var isManaged = opt_data && opt_data.enterpriseManaged; | 1094 var isManaged = opt_data && opt_data.enterpriseManaged; |
1113 $('gaia-whitelist-error').textContent = | 1095 $('gaia-whitelist-error').textContent = loadTimeData.getValue( |
1114 loadTimeData.getValue(isManaged ? 'whitelistErrorEnterprise' : | 1096 isManaged ? 'whitelistErrorEnterprise' : 'whitelistErrorConsumer'); |
1115 'whitelistErrorConsumer'); | |
1116 } | 1097 } |
1117 | 1098 |
1118 this.classList.toggle('whitelist-error', show); | 1099 this.classList.toggle('whitelist-error', show); |
1119 this.loading = !show; | 1100 this.loading = !show; |
1120 | 1101 |
1121 if (show) | 1102 if (show) |
1122 $('gaia-whitelist-error').submitButton.focus(); | 1103 $('gaia-whitelist-error').submitButton.focus(); |
1123 else | 1104 else |
1124 Oobe.showSigninUI(); | 1105 Oobe.showSigninUI(); |
1125 | 1106 |
1126 this.updateControlsState(); | 1107 this.updateControlsState(); |
1127 }, | 1108 }, |
1128 | 1109 |
1129 invalidateAd: function(username, errorState) { | 1110 invalidateAd: function(username, errorState) { |
1130 if (this.screenMode_ != ScreenMode.AD_AUTH) | 1111 if (this.screenMode_ != ScreenMode.AD_AUTH) |
1131 return; | 1112 return; |
1132 var adAuthUI = this.getSigninFrame_(); | 1113 var adAuthUI = this.getSigninFrame_(); |
1133 adAuthUI.setUser(username); | 1114 adAuthUI.setUser(username); |
1134 adAuthUI.setInvalid(errorState); | 1115 adAuthUI.setInvalid(errorState); |
1135 this.loading = false; | 1116 this.loading = false; |
1136 Oobe.getInstance().headerHidden = false; | 1117 Oobe.getInstance().headerHidden = false; |
1137 } | 1118 } |
1138 }; | 1119 }; |
1139 }); | 1120 }); |
OLD | NEW |