fix unauthorized

This commit is contained in:
Ivan Socolsky 2015-04-01 21:34:36 -03:00
parent 2874f6745b
commit f37ec60951
1 changed files with 3 additions and 3 deletions

View File

@ -20,7 +20,7 @@ var io, bcMonitor;
var WsApp = function() {};
WsApp._unauthorized = function() {
WsApp._unauthorized = function(socket) {
socket.emit('unauthorized');
socket.disconnect();
};
@ -52,10 +52,10 @@ WsApp.start = function(server) {
socket.emit('challenge', socket.nonce);
socket.on('authorize', function(data) {
if (data.message != socket.nonce) return WsApp.unauthorized();
if (data.message != socket.nonce) return WsApp._unauthorized(socket);
WalletService.getInstanceWithAuth(data, function(err, service) {
if (err) return WsApp.unauthorized();
if (err) return WsApp._unauthorized(socket);
socket.join(service.walletId);
socket.emit('authorized');