steps 1 and 2

This commit is contained in:
AJ ONeal 2018-05-01 08:29:19 +00:00
parent 40200e4dc5
commit 5d4f71ba8e
2 changed files with 25 additions and 9 deletions

View File

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

View File

@ -18,25 +18,41 @@
$qs('.js-acme-form-domains').addEventListener('submit', function (ev) { $qs('.js-acme-form-domains').addEventListener('submit', function (ev) {
ev.preventDefault(); ev.preventDefault();
info.identifiers = $qs('.js-acme-domains').value.split(/,/g).map(function (hostname) { steps[i].submit(ev);
return { type: 'dns', value: hostname.trim() }; i += 1;
});
return BACME.directory($qs('.js-acme-directory-url').value).then(function () {
i += 1;
steps[i]();
});
}); });
steps[1] = function () { steps[1] = function () {
hideForms(); hideForms();
$qs('.js-acme-form-domains').hidden = false; $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 () { steps[2] = function () {
hideForms(); hideForms();
$qs('.js-acme-form-account').hidden = false; $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 () { steps[3] = function () {
hideForms(); hideForms();