Skip to content

Commit b9a9584

Browse files
committed
add cloudflare dns option to letsencrypt via manual certificate
1 parent 2d7576c commit b9a9584

File tree

3 files changed

+32
-2
lines changed

3 files changed

+32
-2
lines changed

frontend/js/app/nginx/certificates/form.ejs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,24 @@
2020
<input name="meta[letsencrypt_email]" type="email" class="form-control" placeholder="" value="<%- getLetsencryptEmail() %>" required>
2121
</div>
2222
</div>
23+
24+
<!-- CloudFlare -->
25+
<div class="col-sm-12 col-md-12">
26+
<div class="form-group">
27+
<label class="custom-switch">
28+
<input type="checkbox" class="custom-switch-input" name="use_cloudflare" value="1">
29+
<span class="custom-switch-indicator"></span>
30+
<span class="custom-switch-description"><%= i18n('ssl', 'use-cloudflare') %></span>
31+
</label>
32+
</div>
33+
</div>
34+
<div class="col-sm-12 col-md-12 cloudflare">
35+
<div class="form-group">
36+
<label class="form-label">CloudFlare DNS API Token <span class="form-required">*</span></label>
37+
<input type="text" name="cloudflare_dns_api_token" class="form-control" id="input-domains" required>
38+
</div>
39+
</div>
40+
2341
<div class="col-sm-12 col-md-12">
2442
<div class="form-group">
2543
<label class="custom-switch">

frontend/js/app/nginx/certificates/form.js

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,20 @@ module.exports = Mn.View.extend({
2020
save: 'button.save',
2121
other_certificate: '#other_certificate',
2222
other_certificate_key: '#other_certificate_key',
23-
other_intermediate_certificate: '#other_intermediate_certificate'
23+
other_intermediate_certificate: '#other_intermediate_certificate',
24+
cloudflare_switch: 'input[name="use_cloudflare"]',
25+
cloudflare: '.cloudflare'
2426
},
2527

2628
events: {
29+
'change @ui.cloudflare_switch': function() {
30+
let checked = this.ui.cloudflare_switch.prop('checked');
31+
if (checked) {
32+
this.ui.cloudflare.show();
33+
} else {
34+
this.ui.cloudflare.hide();
35+
}
36+
},
2737
'click @ui.save': function (e) {
2838
e.preventDefault();
2939

@@ -146,6 +156,7 @@ module.exports = Mn.View.extend({
146156
},
147157
createFilter: /^(?:[^.*]+\.?)+[^.]$/
148158
});
159+
this.ui.cloudflare.hide();
149160
},
150161

151162
initialize: function (options) {

frontend/js/i18n/messages.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,8 @@
101101
"letsencrypt-email": "Email Address for Let's Encrypt",
102102
"letsencrypt-agree": "I Agree to the <a href=\"{url}\" target=\"_blank\">Let's Encrypt Terms of Service</a>",
103103
"delete-ssl": "The SSL certificates attached will NOT be removed, they will need to be removed manually.",
104-
"hosts-warning": "These domains must be already configured to point to this installation"
104+
"hosts-warning": "These domains must be already configured to point to this installation",
105+
"use-cloudflare": "Use CloudFlare DNS verification"
105106
},
106107
"proxy-hosts": {
107108
"title": "Proxy Hosts",

0 commit comments

Comments
 (0)