mirror of
https://github.com/jc21/nginx-proxy-manager.git
synced 2024-08-30 18:22:48 +00:00
- prevent wildcard generation when not using Cloudflare dns
- fix cloudflare token required logic
This commit is contained in:
parent
077cf75ef2
commit
cff6c4d1f5
@ -34,7 +34,7 @@
|
|||||||
<div class="col-sm-12 col-md-12 cloudflare">
|
<div class="col-sm-12 col-md-12 cloudflare">
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="form-label">CloudFlare DNS API Token <span class="form-required">*</span></label>
|
<label class="form-label">CloudFlare DNS API Token <span class="form-required">*</span></label>
|
||||||
<input type="text" name="meta[cloudflare_token]" class="form-control" id="cloudflare_token" required>
|
<input type="text" name="meta[cloudflare_token]" class="form-control" id="cloudflare_token">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -22,16 +22,19 @@ module.exports = Mn.View.extend({
|
|||||||
other_certificate_key: '#other_certificate_key',
|
other_certificate_key: '#other_certificate_key',
|
||||||
other_intermediate_certificate: '#other_intermediate_certificate',
|
other_intermediate_certificate: '#other_intermediate_certificate',
|
||||||
cloudflare_switch: 'input[name="meta[cloudflare_use]"]',
|
cloudflare_switch: 'input[name="meta[cloudflare_use]"]',
|
||||||
|
cloudflare_token: 'input[name="meta[cloudflare_token]"',
|
||||||
cloudflare: '.cloudflare'
|
cloudflare: '.cloudflare'
|
||||||
},
|
},
|
||||||
|
|
||||||
events: {
|
events: {
|
||||||
'change @ui.cloudflare_switch': function() {
|
'change @ui.cloudflare_switch': function() {
|
||||||
let checked = this.ui.cloudflare_switch.prop('checked');
|
let checked = this.ui.cloudflare_switch.prop('checked');
|
||||||
if (checked) {
|
if (checked) {
|
||||||
|
this.ui.cloudflare_token.prop('required', 'required');
|
||||||
this.ui.cloudflare.show();
|
this.ui.cloudflare.show();
|
||||||
} else {
|
} else {
|
||||||
this.ui.cloudflare.hide();
|
this.ui.cloudflare_token.prop('required', false);
|
||||||
|
this.ui.cloudflare.hide();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
'click @ui.save': function (e) {
|
'click @ui.save': function (e) {
|
||||||
@ -39,7 +42,7 @@ module.exports = Mn.View.extend({
|
|||||||
|
|
||||||
if (!this.ui.form[0].checkValidity()) {
|
if (!this.ui.form[0].checkValidity()) {
|
||||||
$('<input type="submit">').hide().appendTo(this.ui.form).click().remove();
|
$('<input type="submit">').hide().appendTo(this.ui.form).click().remove();
|
||||||
$(this).addClass('btn-loading');
|
$(this).removeClass('btn-loading');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -47,6 +50,22 @@ module.exports = Mn.View.extend({
|
|||||||
let data = this.ui.form.serializeJSON();
|
let data = this.ui.form.serializeJSON();
|
||||||
data.provider = this.model.get('provider');
|
data.provider = this.model.get('provider');
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
let domain_err = false;
|
||||||
|
if (!data.meta.cloudflare_use) {
|
||||||
|
data.domain_names.split(',').map(function (name) {
|
||||||
|
if (name.match(/\*/im)) {
|
||||||
|
domain_err = true;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (domain_err) {
|
||||||
|
alert('Cannot request Let\'s Encrypt Certificate for wildcard domains when not using CloudFlare DNS');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Manipulate
|
// Manipulate
|
||||||
if (typeof data.meta !== 'undefined' && typeof data.meta.letsencrypt_agree !== 'undefined') {
|
if (typeof data.meta !== 'undefined' && typeof data.meta.letsencrypt_agree !== 'undefined') {
|
||||||
data.meta.letsencrypt_agree = !!data.meta.letsencrypt_agree;
|
data.meta.letsencrypt_agree = !!data.meta.letsencrypt_agree;
|
||||||
|
Loading…
Reference in New Issue
Block a user