Fix for password error
The old error handler wasn't really working for unknown reasons, but this seems to fix it.
This commit is contained in:
parent
0390d414f3
commit
68a766af0a
|
@ -17,6 +17,7 @@ weechat.factory('connection',
|
||||||
|
|
||||||
// Takes care of the connection and websocket hooks
|
// Takes care of the connection and websocket hooks
|
||||||
var connect = function (host, port, passwd, ssl, noCompression, successCallback, failCallback) {
|
var connect = function (host, port, passwd, ssl, noCompression, successCallback, failCallback) {
|
||||||
|
$rootScope.passwordError = false;
|
||||||
connectionData = [host, port, passwd, ssl, noCompression];
|
connectionData = [host, port, passwd, ssl, noCompression];
|
||||||
var proto = ssl ? 'wss' : 'ws';
|
var proto = ssl ? 'wss' : 'ws';
|
||||||
// If host is an IPv6 literal wrap it in brackets
|
// If host is an IPv6 literal wrap it in brackets
|
||||||
|
@ -98,11 +99,8 @@ weechat.factory('connection',
|
||||||
$log.info("Connected to relay");
|
$log.info("Connected to relay");
|
||||||
$rootScope.connected = true;
|
$rootScope.connected = true;
|
||||||
},
|
},
|
||||||
function() {
|
function(e) {
|
||||||
// Connection got closed, lets check if we ever was connected successfully
|
handleWrongPassword();
|
||||||
if (!$rootScope.waseverconnected) {
|
|
||||||
$rootScope.passwordError = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -121,12 +119,14 @@ weechat.factory('connection',
|
||||||
* Handles websocket disconnection
|
* Handles websocket disconnection
|
||||||
*/
|
*/
|
||||||
$log.info("Disconnected from relay");
|
$log.info("Disconnected from relay");
|
||||||
|
$rootScope.$emit('relayDisconnect');
|
||||||
if ($rootScope.userdisconnect || !$rootScope.waseverconnected) {
|
if ($rootScope.userdisconnect || !$rootScope.waseverconnected) {
|
||||||
handleClose(evt);
|
handleClose(evt);
|
||||||
$rootScope.userdisconnect = false;
|
$rootScope.userdisconnect = false;
|
||||||
} else {
|
} else {
|
||||||
reconnect(evt);
|
reconnect(evt);
|
||||||
}
|
}
|
||||||
|
handleWrongPassword();
|
||||||
};
|
};
|
||||||
|
|
||||||
var handleClose = function (evt) {
|
var handleClose = function (evt) {
|
||||||
|
@ -140,6 +140,14 @@ weechat.factory('connection',
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
var handleWrongPassword = function() {
|
||||||
|
// Connection got closed, lets check if we ever was connected successfully
|
||||||
|
if (!$rootScope.waseverconnected && !$rootScope.errorMessage) {
|
||||||
|
$rootScope.passwordError = true;
|
||||||
|
$rootScope.$apply();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
var onerror = function (evt) {
|
var onerror = function (evt) {
|
||||||
/*
|
/*
|
||||||
* Handles cases when connection issues come from
|
* Handles cases when connection issues come from
|
||||||
|
|
Loading…
Reference in New Issue