diff --git a/lib/extensions/admin/login/css/main.css b/lib/extensions/admin/login/css/main.css index 69414f2..cf705ec 100644 --- a/lib/extensions/admin/login/css/main.css +++ b/lib/extensions/admin/login/css/main.css @@ -85,7 +85,7 @@ button { margin: 1em 0; } -button[disabled=true] { +button:disabled { background-color: #d9d9d9; } diff --git a/lib/extensions/admin/login/js/app.js b/lib/extensions/admin/login/js/app.js index fdd4537..9751129 100644 --- a/lib/extensions/admin/login/js/app.js +++ b/lib/extensions/admin/login/js/app.js @@ -129,6 +129,20 @@ function init() { console.log(pair); submitCode(pair); }); + + var formElements = document.querySelector('.js-submit').elements; + for(var i = 0; i < formElements.length; ++i) { + var tosCheck = document.querySelector('[name=telebit-agree]'); + var leCheck = document.querySelector('[name=letsencrypt-agree]'); + var pairCodeInput = document.querySelector('[name=pair-code]'); + formElements[i].addEventListener('input', function(ev) { + if(tosCheck.checked && leCheck.checked && pairCodeInput.value.length) { + document.querySelector('.js-submit button').disabled = false; + } else { + document.querySelector('.js-submit button').disabled = true; + } + }); + }; } window.fetch('https://' + location.hostname + '/_apis/telebit.cloud/index.json', {