Browse Source

steps 1 and 2

v1
AJ ONeal 4 years ago
parent
commit
5d4f71ba8e
  1. 2
      index.html
  2. 32
      js/app.js

2
index.html

@ -16,7 +16,7 @@
<label>What's your email?</label>
<input class="js-acme-account-email" type="email" placeholder="john@doe.family" required>
<label><input class="js-acme-account-tos" type="checkbox" required>
Agree to <a class="js-le-tos">Let's Encrypt Terms of Service</a>?</label>
Agree to <a class="js-acme-tos-url" target="acme-tos">Let's Encrypt Terms of Service</a>?</label>
<label><input class="js-greenlock-account-tos" type="checkbox" required>
Agree to <a class="js-gl-tos">Greenlock Terms of Service</a>?</label>
<a href="#">advanced (use existing account)</a>

32
js/app.js

@ -18,25 +18,41 @@
$qs('.js-acme-form-domains').addEventListener('submit', function (ev) {
ev.preventDefault();
info.identifiers = $qs('.js-acme-domains').value.split(/,/g).map(function (hostname) {
return { type: 'dns', value: hostname.trim() };
});
return BACME.directory($qs('.js-acme-directory-url').value).then(function () {
i += 1;
steps[i]();
});
steps[i].submit(ev);
i += 1;
});
steps[1] = function () {
hideForms();
$qs('.js-acme-form-domains').hidden = false;
};
steps[1].submit = function () {
info.identifiers = $qs('.js-acme-domains').value.split(/\s*,\s*/g).map(function (hostname) {
return { type: 'dns', value: hostname.trim() };
});
return BACME.directory($qs('.js-acme-directory-url').value).then(function (directory) {
$qs('.js-acme-tos-url').href = directory.meta.termsOfService;
steps[i]();
});
};
steps[2] = function () {
hideForms();
$qs('.js-acme-form-account').hidden = false;
};
steps[2].submit = function () {
info.contact = [ 'mailto:' + $qs('.js-acme-account-email').value ];
info.agree = $qs('.js-acme-account-tos').checked;
info.greenlockAgree = $qs('.js-gl-tos').checked;
// TODO
// create account key
// create account
// capture email
// submit challenges
// populate challenges in table
steps[i]();
};
steps[3] = function () {
hideForms();

Loading…
Cancel
Save