Merge f9177c92c7 into 17f67ca83c
This commit is contained in:
commit
b0e86981cc
|
|
@ -265,7 +265,6 @@ var RFB;
|
|||
|
||||
sendPassword: function (passwd) {
|
||||
this._rfb_password = passwd;
|
||||
this._rfb_state = 'Authentication';
|
||||
setTimeout(this._init_msg.bind(this), 0);
|
||||
},
|
||||
|
||||
|
|
@ -429,7 +428,6 @@ var RFB;
|
|||
* ProtocolVersion
|
||||
* Security
|
||||
* Authentication
|
||||
* password - waiting for password, not part of RFB
|
||||
* SecurityResult
|
||||
* ClientInitialization - not triggered by server message
|
||||
* ServerInitialization (to normal)
|
||||
|
|
@ -732,7 +730,7 @@ var RFB;
|
|||
var xvp_sep = this._xvp_password_sep;
|
||||
var xvp_auth = this._rfb_password.split(xvp_sep);
|
||||
if (xvp_auth.length < 3) {
|
||||
this._updateState('password', 'XVP credentials required (user' + xvp_sep +
|
||||
Util.Debug('XVP credentials required (user' + xvp_sep +
|
||||
'target' + xvp_sep + 'password) -- got only ' + this._rfb_password);
|
||||
this._onPasswordRequired(this);
|
||||
return false;
|
||||
|
|
@ -750,9 +748,6 @@ var RFB;
|
|||
|
||||
_negotiate_std_vnc_auth: function () {
|
||||
if (this._rfb_password.length === 0) {
|
||||
// Notify via both callbacks since it's kind of
|
||||
// an RFB state change and a UI interface issue
|
||||
this._updateState('password', "Password Required");
|
||||
this._onPasswordRequired(this);
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -192,6 +192,7 @@ var UI;
|
|||
try {
|
||||
UI.rfb = new RFB({'target': $D('noVNC_canvas'),
|
||||
'onUpdateState': UI.updateState,
|
||||
'onPasswordRequired': UI.passwordRequired,
|
||||
'onXvpInit': UI.updateXvpButton,
|
||||
'onClipboard': UI.clipboardReceive,
|
||||
'onFBUComplete': UI.initialResize,
|
||||
|
|
@ -275,23 +276,15 @@ var UI;
|
|||
case 'loaded':
|
||||
klass = "noVNC_status_normal";
|
||||
break;
|
||||
case 'password':
|
||||
UI.toggleConnectPanel();
|
||||
|
||||
$D('noVNC_connect_button').value = "Send Password";
|
||||
$D('noVNC_connect_button').onclick = UI.setPassword;
|
||||
$D('noVNC_setting_password').focus();
|
||||
|
||||
klass = "noVNC_status_warn";
|
||||
break;
|
||||
default:
|
||||
klass = "noVNC_status_warn";
|
||||
break;
|
||||
}
|
||||
|
||||
if (typeof(msg) !== 'undefined') {
|
||||
$D('noVNC_control_bar').setAttribute("class", klass);
|
||||
if (typeof(msg) !== 'undefined') {
|
||||
$D('noVNC_status').innerHTML = msg;
|
||||
|
||||
}
|
||||
|
||||
UI.updateVisualState();
|
||||
|
|
@ -750,6 +743,25 @@ var UI;
|
|||
// Don't display the connection settings until we're actually disconnected
|
||||
},
|
||||
|
||||
/* ------^-------
|
||||
* /CONNECTION
|
||||
* ==============
|
||||
* PASSWORD
|
||||
* ------v------*/
|
||||
|
||||
passwordRequired: function(rfb) {
|
||||
UI.connSettingsOpen = false;
|
||||
UI.toggleConnectPanel();
|
||||
|
||||
$D('noVNC_connect_button').value = "Send Password";
|
||||
$D('noVNC_connect_button').onclick = UI.setPassword;
|
||||
$D('noVNC_setting_password').focus();
|
||||
|
||||
var msg = "Password is required";
|
||||
UI.popupStatus(msg);
|
||||
UI.updateState(null, "warning", null, msg);
|
||||
},
|
||||
|
||||
setPassword: function() {
|
||||
UI.rfb.sendPassword($D('noVNC_setting_password').value);
|
||||
//Reset connect button.
|
||||
|
|
@ -761,7 +773,7 @@ var UI;
|
|||
},
|
||||
|
||||
/* ------^-------
|
||||
* /CONNECTION
|
||||
* /PASSWORD
|
||||
* ==============
|
||||
* FULLSCREEN
|
||||
* ------v------*/
|
||||
|
|
|
|||
|
|
@ -107,10 +107,9 @@ describe('Remote Frame Buffer Protocol Client', function() {
|
|||
beforeEach(function () { this.clock = sinon.useFakeTimers(); });
|
||||
afterEach(function () { this.clock.restore(); });
|
||||
|
||||
it('should set the state to "Authentication"', function () {
|
||||
client._rfb_state = "blah";
|
||||
it('should set the rfb password properly"', function () {
|
||||
client.sendPassword('pass');
|
||||
expect(client._rfb_state).to.equal('Authentication');
|
||||
expect(client._rfb_password).to.equal('pass');
|
||||
});
|
||||
|
||||
it('should call init_msg "soon"', function () {
|
||||
|
|
@ -704,9 +703,13 @@ describe('Remote Frame Buffer Protocol Client', function() {
|
|||
client._rfb_version = 3.8;
|
||||
});
|
||||
|
||||
it('should transition to the "password" state if missing a password', function () {
|
||||
it('should call the passwordRequired callback if missing a password', function () {
|
||||
client.set_onPasswordRequired(sinon.spy());
|
||||
send_security(2, client);
|
||||
expect(client._rfb_state).to.equal('password');
|
||||
|
||||
var spy = client.get_onPasswordRequired();
|
||||
expect(client._rfb_password.length).to.equal(0);
|
||||
expect(spy).to.have.been.calledOnce;
|
||||
});
|
||||
|
||||
it('should encrypt the password with DES and then send it back', function () {
|
||||
|
|
@ -753,15 +756,23 @@ describe('Remote Frame Buffer Protocol Client', function() {
|
|||
expect(client._negotiate_std_vnc_auth).to.have.been.calledOnce;
|
||||
});
|
||||
|
||||
it('should transition to the "password" state if the passwords is missing', function() {
|
||||
it('should call the passwordRequired callback if the password is missing', function() {
|
||||
client.set_onPasswordRequired(sinon.spy());
|
||||
client._rfb_password = '';
|
||||
send_security(22, client);
|
||||
expect(client._rfb_state).to.equal('password');
|
||||
|
||||
var spy = client.get_onPasswordRequired();
|
||||
expect(client._rfb_password.length).to.equal(0);
|
||||
expect(spy).to.have.been.calledOnce;
|
||||
});
|
||||
|
||||
it('should transition to the "password" state if the passwords is improperly formatted', function() {
|
||||
it('should call the passwordRequired callback if the password is improperly formatted', function() {
|
||||
client.set_onPasswordRequired(sinon.spy());
|
||||
client._rfb_password = 'user@target';
|
||||
send_security(22, client);
|
||||
expect(client._rfb_state).to.equal('password');
|
||||
|
||||
var spy = client.get_onPasswordRequired();
|
||||
expect(spy).to.have.been.calledOnce;
|
||||
});
|
||||
|
||||
it('should split the password, send the first two parts, and pass on the last part', function () {
|
||||
|
|
|
|||
Loading…
Reference in New Issue