Clear HTTP Request node authType when auth disabled

Fixes #2215
This commit is contained in:
Nick O'Leary 2019-06-20 22:33:38 +01:00
parent e315325d91
commit 46abd0cc42
No known key found for this signature in database
GPG Key ID: 4F2157149161A6C9
1 changed files with 12 additions and 8 deletions

View File

@ -49,12 +49,13 @@
<label for="node-input-useAuth" style="width: 70%;"><span data-i18n="httpin.basicauth"></span></label>
<div style="margin-left: 20px" class="node-input-useAuth-row hide">
<div class="form-row">
<label for="node-input-authType"><i class="fa fa-user-secret "></i> <span data-i18n="httpin.label.authType"></span></label>
<select type="text" id="node-input-authType" style="width:70%;">
<label for="node-input-authType-select"><i class="fa fa-user-secret "></i> <span data-i18n="httpin.label.authType"></span></label>
<select type="text" id="node-input-authType-select" style="width:70%;">
<option value="basic" data-i18n="httpin.basic"></option>
<option value="digest" data-i18n="httpin.digest"></option>
<option value="bearer" data-i18n="httpin.bearer"></option>
</select>
<input type="hidden" id="node-input-authType">
</div>
<div class="form-row node-input-basic-row">
<label for="node-input-user"><i class="fa fa-user"></i> <span data-i18n="common.label.username"></span></label>
@ -102,7 +103,7 @@
url:{value:"",validate:function(v) { return (v.trim().length === 0) || (v.indexOf("://") === -1) || (v.trim().indexOf("http") === 0)} },
tls: {type:"tls-config",required: false},
proxy: {type:"http proxy",required: false},
authType: {value: "basic"}
authType: {value: ""}
},
credentials: {
user: {type:"text"},
@ -130,7 +131,7 @@
$(".node-input-useAuth-row").show();
// Nodes (< version 0.20.x) with credentials but without authentication type, need type 'basic'
if (!$('#node-input-authType').val()) {
$('#node-input-authType').val('basic');
$("#node-input-authType-select").val('basic').trigger("change");
}
} else {
$(".node-input-useAuth-row").hide();
@ -139,12 +140,14 @@
$('#node-input-password').val('');
}
});
$("#node-input-authType").change(function() {
if ($(this).val() == "basic" || $(this).val() == "digest") {
$("#node-input-authType-select").change(function() {
var val = $(this).val();
$("#node-input-authType").val(val);
if (val === "basic" || val === "digest") {
$(".node-input-basic-row").show();
$('#node-span-password').show();
$('#node-span-token').hide();
} else if ($(this).val() == "bearer") {
} else if (val === "bearer") {
$(".node-input-basic-row").hide();
$('#node-span-password').hide();
$('#node-span-token').show();
@ -158,8 +161,9 @@
$(".node-input-paytoqs-row").hide();
}
});
if (this.credentials.user || this.credentials.has_password) {
if (this.authType) {
$('#node-input-useAuth').prop('checked', true);
$("#node-input-authType-select").val(this.authType);
} else {
$('#node-input-useAuth').prop('checked', false);
}