| Index: remoting/webapp/base/js/auth_init.js
|
| diff --git a/remoting/webapp/base/js/auth_init.js b/remoting/webapp/base/js/auth_init.js
|
| index 2602efc8112998bda10b4c8b85bc85fb9e822707..a49bfa58d54bd5aaf01d727611b08b9541bf4830 100644
|
| --- a/remoting/webapp/base/js/auth_init.js
|
| +++ b/remoting/webapp/base/js/auth_init.js
|
| @@ -16,34 +16,6 @@ var remoting = remoting || {};
|
| */
|
| remoting.initIdentity = function(onUserInfoAvailable) {
|
|
|
| - /**
|
| - * Show the authorization consent UI and register a one-shot event handler to
|
| - * continue the authorization process.
|
| - *
|
| - * @param {function():void} authContinue Callback to invoke when the user
|
| - * clicks "Continue".
|
| - */
|
| - function promptForConsent(authContinue) {
|
| - /** @type {HTMLElement} */
|
| - var dialog = document.getElementById('auth-dialog');
|
| - /** @type {HTMLElement} */
|
| - var button = document.getElementById('auth-button');
|
| - var consentGranted = function(event) {
|
| - dialog.hidden = true;
|
| - button.removeEventListener('click', consentGranted, false);
|
| - authContinue();
|
| - remoting.windowShape.updateClientWindowShape();
|
| - };
|
| - dialog.hidden = false;
|
| -
|
| - /** @type {HTMLElement} */
|
| - var dialog_border = document.getElementById('auth-dialog-border');
|
| - remoting.authDialog = new remoting.AuthDialog(dialog_border);
|
| - remoting.windowShape.addCallback(remoting.authDialog);
|
| -
|
| - button.addEventListener('click', consentGranted, false);
|
| - }
|
| -
|
| /** @param {remoting.Error} error */
|
| function onGetIdentityInfoError(error) {
|
| // No need to show the error message for NOT_AUTHENTICATED
|
| @@ -54,16 +26,18 @@ remoting.initIdentity = function(onUserInfoAvailable) {
|
| }
|
|
|
| if (base.isAppsV2()) {
|
| - remoting.identity = new remoting.Identity(promptForConsent);
|
| + remoting.identity = new remoting.Identity();
|
| } else {
|
| // TODO(garykac) Remove this and replace with identity.
|
| remoting.oauth2 = new remoting.OAuth2();
|
| - if (!remoting.oauth2.isAuthenticated()) {
|
| - document.getElementById('auth-dialog').hidden = false;
|
| - }
|
| remoting.identity = remoting.oauth2;
|
| + if (!remoting.identity.isAuthenticated()) {
|
| + remoting.AuthDialog.show().then(function() {
|
| + remoting.identity.handleAuthFailureAndRelaunch();
|
| + });
|
| + }
|
| }
|
|
|
| remoting.identity.getUserInfo(onUserInfoAvailable,
|
| onGetIdentityInfoError);
|
| -}
|
| +};
|
|
|