Change layout and autoconnect behaviour. Add info next to topt function
This commit is contained in:
parent
e87d74243f
commit
012bd88258
24
index.html
24
index.html
@ -100,21 +100,31 @@
|
|||||||
<div class="panel-body">
|
<div class="panel-body">
|
||||||
<form class="form-signin" role="form">
|
<form class="form-signin" role="form">
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="control-label" for="host">WeeChat relay hostname and port number</label>
|
|
||||||
<div class="input-group">
|
<div class="input-group">
|
||||||
<div class="row no-gutter">
|
<div class="row no-gutter">
|
||||||
<div class="col-sm-9">
|
<div class="col-sm-9">
|
||||||
|
<label class="control-label" for="host">WeeChat relay hostname</label>
|
||||||
<input type="text" class="form-control favorite-font" id="host" ng-model="settings.hostField" ng-change="parseHost()" ng-class="{'is-invalid': hostInvalid}" placeholder="Address" autocapitalize="off">
|
<input type="text" class="form-control favorite-font" id="host" ng-model="settings.hostField" ng-change="parseHost()" ng-class="{'is-invalid': hostInvalid}" placeholder="Address" autocapitalize="off">
|
||||||
</div>
|
</div>
|
||||||
<div class="col-sm-3">
|
<div class="col-sm-3">
|
||||||
|
<label class="control-label" for="port">Port</label>
|
||||||
<input type="text" class="form-control favorite-font" id="port" ng-model="settings.port" ng-disabled="portDisabled" placeholder="Port">
|
<input type="text" class="form-control favorite-font" id="port" ng-model="settings.port" ng-disabled="portDisabled" placeholder="Port">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<label class="control-label" for="password">WeeChat relay password</label>
|
<div class="row no-gutter">
|
||||||
<input type="password" class="form-control favorite-font" id="password" ng-model="password" placeholder="Password">
|
<div ng-class="settings.useTotp ? 'col-sm-9' : 'col-sm-12'" ng>
|
||||||
|
<label class="control-label" for="password">WeeChat relay password</label>
|
||||||
|
<input type="password" class="form-control favorite-font" id="password" ng-model="password" placeholder="Password">
|
||||||
|
</div>
|
||||||
|
<div class="col-sm-3" ng-Show="settings.useTotp">
|
||||||
|
<label class="control-label" for="totp">Token</label>
|
||||||
|
<input type="text" class="form-control favorite-font" id="totp" ng-model="totp" autocomplete="off">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<div class="alert alert-danger" ng-show="passwordError" ng-cloak>
|
<div class="alert alert-danger" ng-show="passwordError" ng-cloak>
|
||||||
Error: wrong password or one-time password
|
Error: wrong password or token
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="checkbox">
|
<div class="checkbox">
|
||||||
@ -137,12 +147,10 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="checkbox">
|
<div class="checkbox">
|
||||||
<label class="control-label" for="useTotp">
|
<label class="control-label" for="useTotp">
|
||||||
<input type="checkbox" id="useTotp" ng-model="settings.useTotp" ng-change="changeUseTOTP()">
|
<input type="checkbox" id="useTotp" ng-model="settings.useTotp">
|
||||||
Use Time-based One-Time Password
|
Use Time-based One-Time Password <a href="https://blog.weechat.org/post/2019/01/14/Support-of-TOTP">ℹ️</a>
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
<label class="control-label" for="totp" ng-Show="settings.useTotp">One time password</label>
|
|
||||||
<input type="text" class="form-control favorite-font" id="totp" ng-model="totp" ng-Show="settings.useTotp" ng-model="totp" autocomplete="off">
|
|
||||||
</div>
|
</div>
|
||||||
<button class="btn btn-lg btn-primary" ng-disabled="hostInvalid" ng-click="connect()" ng-cloak>{{ connectbutton }} <i ng-class="connectbuttonicon" class="glyphicon"></i></button>
|
<button class="btn btn-lg btn-primary" ng-disabled="hostInvalid" ng-click="connect()" ng-cloak>{{ connectbutton }} <i ng-class="connectbuttonicon" class="glyphicon"></i></button>
|
||||||
</form>
|
</form>
|
||||||
|
@ -328,9 +328,15 @@ weechat.factory('connection',
|
|||||||
};
|
};
|
||||||
|
|
||||||
var attemptReconnect = function (bufferId, timeout) {
|
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...');
|
$log.info('Attempting to reconnect...');
|
||||||
var d = connectionData;
|
var d = connectionData;
|
||||||
// won't work if totp is mandatory
|
|
||||||
connect(d[0], d[1], d[2], d[3], d[4], false, "", function() {
|
connect(d[0], d[1], d[2], d[3], d[4], false, "", function() {
|
||||||
$rootScope.reconnecting = false;
|
$rootScope.reconnecting = false;
|
||||||
// on success, update active buffer
|
// on success, update active buffer
|
||||||
|
@ -688,12 +688,11 @@ weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout',
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.changeUseTOTP = function() {
|
settings.addCallback('useTotp', function() {
|
||||||
if (settings.useTotp) {
|
if (settings.useTotp) {
|
||||||
settings.autoconnect = false;
|
settings.autoconnect = false;
|
||||||
}
|
}
|
||||||
};
|
});
|
||||||
|
|
||||||
|
|
||||||
$scope.connect = function() {
|
$scope.connect = function() {
|
||||||
notifications.requestNotificationPermission();
|
notifications.requestNotificationPermission();
|
||||||
|
Loading…
Reference in New Issue
Block a user