Validate token field
This commit is contained in:
parent
012bd88258
commit
876a9351ac
@ -120,7 +120,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="col-sm-3" ng-Show="settings.useTotp">
|
<div class="col-sm-3" ng-Show="settings.useTotp">
|
||||||
<label class="control-label" for="totp">Token</label>
|
<label class="control-label" for="totp">Token</label>
|
||||||
<input type="text" class="form-control favorite-font" id="totp" ng-model="totp" autocomplete="off">
|
<input type="text" class="form-control favorite-font" id="totp" ng-model="totp" ng-change="parseTotp()" ng-class="{'is-invalid': totpInvalid}" autocomplete="off">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="alert alert-danger" ng-show="passwordError" ng-cloak>
|
<div class="alert alert-danger" ng-show="passwordError" ng-cloak>
|
||||||
@ -152,7 +152,7 @@
|
|||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
</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 || (totpInvalid && settings.useTotp)" ng-click="connect()" ng-cloak>{{ connectbutton }} <i ng-class="connectbuttonicon" class="glyphicon"></i></button>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -694,6 +694,10 @@ weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout',
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$scope.parseTotp = function() {
|
||||||
|
$scope.totpInvalid = !/^\d{6}$/.test($scope.totp);
|
||||||
|
};
|
||||||
|
|
||||||
$scope.connect = function() {
|
$scope.connect = function() {
|
||||||
notifications.requestNotificationPermission();
|
notifications.requestNotificationPermission();
|
||||||
$rootScope.sslError = false;
|
$rootScope.sslError = false;
|
||||||
|
Loading…
Reference in New Issue
Block a user