| Index: remoting/webapp/crd/js/host_controller.js
|
| diff --git a/remoting/webapp/crd/js/host_controller.js b/remoting/webapp/crd/js/host_controller.js
|
| index 4a37ee24ea4f3098edc7340869d0231a29733bdc..17e29edd126084b6f19a9ad05645f9497f0dbebc 100644
|
| --- a/remoting/webapp/crd/js/host_controller.js
|
| +++ b/remoting/webapp/crd/js/host_controller.js
|
| @@ -184,16 +184,18 @@ remoting.HostController.prototype.start = function(hostPin, consent, onDone,
|
| private_key: privateKey
|
| };
|
| var hostOwner = clientBaseJid;
|
| - var hostOwnerEmail = remoting.identity.getCachedEmail();
|
| - if (hostOwner != xmppLogin) {
|
| - hostConfig['host_owner'] = hostOwner;
|
| - if (hostOwnerEmail != hostOwner) {
|
| - hostConfig['host_owner_email'] = hostOwnerEmail;
|
| - }
|
| - }
|
| - that.hostDaemonFacade_.startDaemon(
|
| - hostConfig, consent, onStarted.bind(null, hostName, publicKey),
|
| - onStartError);
|
| + remoting.identity.getEmail().then(
|
| + function(/** string */ hostOwnerEmail) {
|
| + if (hostOwner != xmppLogin) {
|
| + hostConfig['host_owner'] = hostOwner;
|
| + if (hostOwnerEmail != hostOwner) {
|
| + hostConfig['host_owner_email'] = hostOwnerEmail;
|
| + }
|
| + }
|
| + that.hostDaemonFacade_.startDaemon(
|
| + hostConfig, consent, onStarted.bind(null, hostName, publicKey),
|
| + onStartError);
|
| + });
|
| }
|
|
|
| /**
|
| @@ -248,13 +250,14 @@ remoting.HostController.prototype.start = function(hostPin, consent, onDone,
|
| onError);
|
| } else {
|
| // No authorization code returned, use regular user credential flow.
|
| - that.hostDaemonFacade_.getPinHash(
|
| - newHostId, hostPin, startHostWithHash.bind(
|
| - null, hostName, publicKey, privateKey,
|
| - remoting.identity.getCachedEmail(),
|
| - remoting.oauth2.getRefreshToken(),
|
| - remoting.identity.getCachedEmail()),
|
| - onError);
|
| + remoting.identity.getEmail().then(
|
| + function(/** string */ email) {
|
| + that.hostDaemonFacade_.getPinHash(
|
| + newHostId, hostPin, startHostWithHash.bind(
|
| + null, hostName, publicKey, privateKey,
|
| + email, remoting.oauth2.getRefreshToken(), email),
|
| + onError);
|
| + });
|
| }
|
| } else {
|
| console.log('Failed to register the host. Status: ' + xhr.status +
|
|
|