| Index: remoting/webapp/session_connector.js
|
| diff --git a/remoting/webapp/session_connector.js b/remoting/webapp/session_connector.js
|
| index 015e43eddfdf004191475b764f52074c1731a88d..981404f2834dbc688a6f6d88b477bc0f06853078 100644
|
| --- a/remoting/webapp/session_connector.js
|
| +++ b/remoting/webapp/session_connector.js
|
| @@ -104,6 +104,13 @@ remoting.SessionConnector = function(pluginParent, onOk, onError) {
|
| */
|
| this.wcsAccessTokenRefreshTimer_ = 0;
|
|
|
| + /**
|
| + * Function to interactively obtain the PIN from the user.
|
| + * @param {function(string):void} onPinFetched Called when the PIN is fetched.
|
| + * @private
|
| + */
|
| + this.fetchPin_ = function(onPinFetched) {};
|
| +
|
| // Pre-load WCS to improve connection time.
|
| remoting.identity.callWithToken(this.loadWcs_.bind(this), this.onError_);
|
| };
|
| @@ -112,13 +119,14 @@ remoting.SessionConnector = function(pluginParent, onOk, onError) {
|
| * Initiate a Me2Me connection.
|
| *
|
| * @param {remoting.Host} host The Me2Me host to which to connect.
|
| - * @param {string} pin The PIN as entered by the user.
|
| + * @param {function(function(string):void):void} fetchPin Function to
|
| + * interactively obtain the PIN from the user.
|
| * @return {void} Nothing.
|
| */
|
| -remoting.SessionConnector.prototype.connectMe2Me = function(host, pin) {
|
| +remoting.SessionConnector.prototype.connectMe2Me = function(host, fetchPin) {
|
| this.hostId_ = host.hostId;
|
| this.hostJid_ = host.jabberId;
|
| - this.passPhrase_ = pin;
|
| + this.fetchPin_ = fetchPin;
|
| this.createSessionIfReady_();
|
| };
|
|
|
| @@ -255,9 +263,8 @@ remoting.SessionConnector.prototype.createSessionIfReady_ = function() {
|
|
|
| var securityTypes = 'spake2_hmac,spake2_plain';
|
| this.clientSession_ = new remoting.ClientSession(
|
| - this.hostJid_, this.clientJid_, this.hostPublicKey_,
|
| - this.passPhrase_, securityTypes, this.hostId_,
|
| - this.connectionMode_);
|
| + this.hostJid_, this.clientJid_, this.hostPublicKey_, this.passPhrase_,
|
| + this.fetchPin_, securityTypes, this.hostId_, this.connectionMode_);
|
| this.clientSession_.logHostOfflineErrors(!this.refreshHostJidIfOffline_);
|
| this.clientSession_.setOnStateChange(this.onStateChange_.bind(this));
|
| this.clientSession_.createPluginAndConnect(this.pluginParent_);
|
| @@ -347,7 +354,7 @@ remoting.SessionConnector.prototype.onHostListRefresh_ = function(success) {
|
| if (success) {
|
| var host = remoting.hostList.getHostForId(this.hostId_);
|
| if (host) {
|
| - this.connectMe2Me(host, this.passPhrase_);
|
| + this.connectMe2Me(host, this.fetchPin_);
|
| return;
|
| }
|
| }
|
| @@ -410,4 +417,4 @@ remoting.SessionConnector.prototype.normalizeAccessCode_ =
|
| function(accessCode) {
|
| // Trim whitespace.
|
| return accessCode.replace(/\s/g, '');
|
| -};
|
| +};
|
|
|