diff --git a/index.html b/index.html index 4c968ea..cb57b1e 100644 --- a/index.html +++ b/index.html @@ -16,7 +16,7 @@ + Agree to Let's Encrypt Terms of Service? advanced (use existing account) diff --git a/js/app.js b/js/app.js index 73d30ee..d2ecc3e 100644 --- a/js/app.js +++ b/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();