| 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 loading time after which error message must be displayed and | 10 // Gaia loading time after which error message must be displayed and |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 | 26 |
| 27 return { | 27 return { |
| 28 EXTERNAL_API: [ | 28 EXTERNAL_API: [ |
| 29 'loadAuthExtension', | 29 'loadAuthExtension', |
| 30 'updateAuthExtension', | 30 'updateAuthExtension', |
| 31 'doReload', | 31 'doReload', |
| 32 'onWebviewError', | 32 'onWebviewError', |
| 33 'onFrameError', | 33 'onFrameError', |
| 34 'updateCancelButtonState', | 34 'updateCancelButtonState', |
| 35 'showWhitelistCheckFailedError', | 35 'showWhitelistCheckFailedError', |
| 36 'updateDeviceId', | |
| 37 ], | 36 ], |
| 38 | 37 |
| 39 /** | 38 /** |
| 40 * Frame loading error code (0 - no error). | 39 * Frame loading error code (0 - no error). |
| 41 * @type {number} | 40 * @type {number} |
| 42 * @private | 41 * @private |
| 43 */ | 42 */ |
| 44 error_: 0, | 43 error_: 0, |
| 45 | 44 |
| 46 /** | 45 /** |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 this.gaiaAuthHost_.addEventListener( | 145 this.gaiaAuthHost_.addEventListener( |
| 147 'ready', this.onAuthReady_.bind(this)); | 146 'ready', this.onAuthReady_.bind(this)); |
| 148 this.gaiaAuthHost_.addEventListener( | 147 this.gaiaAuthHost_.addEventListener( |
| 149 'dialogShown', this.onDialogShown_.bind(this)); | 148 'dialogShown', this.onDialogShown_.bind(this)); |
| 150 this.gaiaAuthHost_.addEventListener( | 149 this.gaiaAuthHost_.addEventListener( |
| 151 'dialogHidden', this.onDialogHidden_.bind(this)); | 150 'dialogHidden', this.onDialogHidden_.bind(this)); |
| 152 this.gaiaAuthHost_.addEventListener( | 151 this.gaiaAuthHost_.addEventListener( |
| 153 'backButton', this.onBackButton_.bind(this)); | 152 'backButton', this.onBackButton_.bind(this)); |
| 154 this.gaiaAuthHost_.addEventListener( | 153 this.gaiaAuthHost_.addEventListener( |
| 155 'showView', this.onShowView_.bind(this)); | 154 'showView', this.onShowView_.bind(this)); |
| 156 this.gaiaAuthHost_.addEventListener('attemptLogin', | |
| 157 this.onAttemptLogin_.bind(this)); | |
| 158 this.gaiaAuthHost_.confirmPasswordCallback = | 155 this.gaiaAuthHost_.confirmPasswordCallback = |
| 159 this.onAuthConfirmPassword_.bind(this); | 156 this.onAuthConfirmPassword_.bind(this); |
| 160 this.gaiaAuthHost_.noPasswordCallback = | 157 this.gaiaAuthHost_.noPasswordCallback = |
| 161 this.onAuthNoPassword_.bind(this); | 158 this.onAuthNoPassword_.bind(this); |
| 162 this.gaiaAuthHost_.insecureContentBlockedCallback = | 159 this.gaiaAuthHost_.insecureContentBlockedCallback = |
| 163 this.onInsecureContentBlocked_.bind(this); | 160 this.onInsecureContentBlocked_.bind(this); |
| 164 this.gaiaAuthHost_.missingGaiaInfoCallback = | 161 this.gaiaAuthHost_.missingGaiaInfoCallback = |
| 165 this.missingGaiaInfo_.bind(this); | 162 this.missingGaiaInfo_.bind(this); |
| 166 this.gaiaAuthHost_.samlApiUsedCallback = | 163 this.gaiaAuthHost_.samlApiUsedCallback = |
| 167 this.samlApiUsed_.bind(this); | 164 this.samlApiUsed_.bind(this); |
| (...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 631 if (this.errorBubble_) { | 628 if (this.errorBubble_) { |
| 632 this.showErrorBubble(this.errorBubble_[0], this.errorBubble_[1]); | 629 this.showErrorBubble(this.errorBubble_[0], this.errorBubble_[1]); |
| 633 this.errorBubble_ = undefined; | 630 this.errorBubble_ = undefined; |
| 634 } | 631 } |
| 635 | 632 |
| 636 chrome.send('loginWebuiReady'); | 633 chrome.send('loginWebuiReady'); |
| 637 chrome.send('loginVisible', ['gaia-signin']); | 634 chrome.send('loginVisible', ['gaia-signin']); |
| 638 }, | 635 }, |
| 639 | 636 |
| 640 /** | 637 /** |
| 641 * Invoked when the auth host emits 'attemptLogin' event. | |
| 642 * @param {Object} Message object with |detail| field keeping email: | |
| 643 * like {detail: 'user@gmail.com'} . | |
| 644 * @private | |
| 645 */ | |
| 646 onAttemptLogin_: function(e) { | |
| 647 chrome.send('attemptLogin', [e.detail]); | |
| 648 }, | |
| 649 | |
| 650 /** | |
| 651 * Invoked when the user has successfully authenticated via SAML, the | 638 * Invoked when the user has successfully authenticated via SAML, the |
| 652 * principals API was not used and the auth host needs the user to confirm | 639 * principals API was not used and the auth host needs the user to confirm |
| 653 * the scraped password. | 640 * the scraped password. |
| 654 * @param {string} email The authenticated user's e-mail. | 641 * @param {string} email The authenticated user's e-mail. |
| 655 * @param {number} passwordCount The number of passwords that were scraped. | 642 * @param {number} passwordCount The number of passwords that were scraped. |
| 656 * @private | 643 * @private |
| 657 */ | 644 */ |
| 658 onAuthConfirmPassword_: function(email, passwordCount) { | 645 onAuthConfirmPassword_: function(email, passwordCount) { |
| 659 this.loading = true; | 646 this.loading = true; |
| 660 Oobe.getInstance().headerHidden = false; | 647 Oobe.getInstance().headerHidden = false; |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 748 if (credentials.hasOwnProperty('authCodeOnly') && | 735 if (credentials.hasOwnProperty('authCodeOnly') && |
| 749 credentials.authCodeOnly) { | 736 credentials.authCodeOnly) { |
| 750 chrome.send('completeAuthenticationAuthCodeOnly', | 737 chrome.send('completeAuthenticationAuthCodeOnly', |
| 751 [credentials.authCode]); | 738 [credentials.authCode]); |
| 752 } else { | 739 } else { |
| 753 chrome.send('completeAuthentication', [ | 740 chrome.send('completeAuthentication', [ |
| 754 credentials.gaiaId, | 741 credentials.gaiaId, |
| 755 credentials.email, | 742 credentials.email, |
| 756 credentials.password, | 743 credentials.password, |
| 757 credentials.authCode, | 744 credentials.authCode, |
| 758 credentials.usingSAML, | 745 credentials.usingSAML |
| 759 credentials.deviceId | |
| 760 ]); | 746 ]); |
| 761 } | 747 } |
| 762 } else { | 748 } else { |
| 763 chrome.send('completeLogin', | 749 chrome.send('completeLogin', |
| 764 [credentials.gaiaId, | 750 [credentials.gaiaId, |
| 765 credentials.email, | 751 credentials.email, |
| 766 credentials.password, | 752 credentials.password, |
| 767 credentials.usingSAML]); | 753 credentials.usingSAML]); |
| 768 } | 754 } |
| 769 | 755 |
| (...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 954 $('gaia-whitelist-error').textContent = | 940 $('gaia-whitelist-error').textContent = |
| 955 loadTimeData.getValue(isManaged ? 'whitelistErrorEnterprise' : | 941 loadTimeData.getValue(isManaged ? 'whitelistErrorEnterprise' : |
| 956 'whitelistErrorConsumer'); | 942 'whitelistErrorConsumer'); |
| 957 } | 943 } |
| 958 | 944 |
| 959 this.classList.toggle('whitelist-error', show); | 945 this.classList.toggle('whitelist-error', show); |
| 960 this.loading = !show; | 946 this.loading = !show; |
| 961 | 947 |
| 962 if (!show) | 948 if (!show) |
| 963 Oobe.showSigninUI(); | 949 Oobe.showSigninUI(); |
| 964 }, | 950 } |
| 965 | |
| 966 /** | |
| 967 * Inform Gaia of new deviceId. | |
| 968 * @param {data} Object like {'deviceId': 'test-device-id'} | |
| 969 */ | |
| 970 updateDeviceId: function(data) { | |
| 971 if (!this.isNewGaiaFlow) | |
| 972 return; | |
| 973 | |
| 974 if (data && data.deviceId) | |
| 975 this.gaiaAuthHost_.updateDeviceId(data.deviceId); | |
| 976 }, | |
| 977 }; | 951 }; |
| 978 }); | 952 }); |
| OLD | NEW |