diff --git a/index.html b/index.html
index 3da29a8..e66f13c 100644
--- a/index.html
+++ b/index.html
@@ -100,21 +100,31 @@
diff --git a/js/connection.js b/js/connection.js
index d84ac76..b521332 100644
--- a/js/connection.js
+++ b/js/connection.js
@@ -328,9 +328,15 @@ weechat.factory('connection',
};
var attemptReconnect = function (bufferId, timeout) {
+ // won't work if totp is mandatory
+ if (settings.useTotp)
+ {
+ $log.info('Not reconnecting because totp will be expired.');
+ return;
+ }
+
$log.info('Attempting to reconnect...');
var d = connectionData;
- // won't work if totp is mandatory
connect(d[0], d[1], d[2], d[3], d[4], false, "", function() {
$rootScope.reconnecting = false;
// on success, update active buffer
diff --git a/js/glowingbear.js b/js/glowingbear.js
index a139787..d85114c 100644
--- a/js/glowingbear.js
+++ b/js/glowingbear.js
@@ -688,12 +688,11 @@ weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout',
}
};
- $scope.changeUseTOTP = function() {
+ settings.addCallback('useTotp', function() {
if (settings.useTotp) {
settings.autoconnect = false;
}
- };
-
+ });
$scope.connect = function() {
notifications.requestNotificationPermission();