diff options
author | grant-kun <[email protected]> | 2022-10-19 08:42:39 -0500 |
---|---|---|
committer | grant-kun <[email protected]> | 2022-10-19 08:42:39 -0500 |
commit | 1f82c948ac210dc03dadf243d5441139cd50ab03 (patch) | |
tree | 236abd3f6686f9d9a4ef5932af1043033055e728 /html | |
parent | 11bfeb2d410acf5e5faca67215341289fdaf8462 (diff) |
email reg
Diffstat (limited to 'html')
-rw-r--r-- | html/mail.html | 43 |
1 files changed, 34 insertions, 9 deletions
diff --git a/html/mail.html b/html/mail.html index 7dc9951..857dc1b 100644 --- a/html/mail.html +++ b/html/mail.html @@ -312,21 +312,46 @@ let emails = [] let bod let html = false + function reg() { + console.log(document.getElementById('email').value) + sendenc('/reg', { 'address': document.getElementById('email').value, 'host': document.getElementById('host').value, 'port': document.getElementById('port').value, 'creds': document.getElementById('auth').value }).then(() => { + update() + }) + } function update() { //console.log('hi') let promie = new Promise((resolve, reject) => { sendenc('/get/update', { 'user': 'root', 'requested': 0, 'login_key': getCookie('login_key') }).then(res => { res = JSON.parse(res) console.log('parsed') - emails = res.messages.reverse() - //console.log(res) - console.log(res) - bod = res.bod - if (res.bod == 'body[2]') { - html = true + if (res.messages == 'reg') { + document.body.style.backgroundColor = '#444444' + document.body.innerHTML = ` + <h1>welcome! please add an email:)</h1> + + email: <input style='background-color:rgba(200,200,200,.3);border-color:rgba(80,80,80,.1);border:line;border-radius:4px;padding:5px;'id="email"></input> + </br> + auth/password: <input style='background-color:rgba(200,200,200,.3);border-color:rgba(80,80,80,.1);border:line;border-radius:4px;padding:5px;'type="password" id="auth"></input> + </br> + host: <input style='background-color:rgba(200,200,200,.3);border-color:rgba(80,80,80,.1);border:line;border-radius:4px;padding:5px;'id="host"></input> + </br> + port: <input style='background-color:rgba(200,200,200,.3);border-color:rgba(80,80,80,.1);border:line;border-radius:4px;padding:5px;'value='993' id="port"></input> + </br> + <input style='background-color:rgba(200,200,200,.3);border-color:rgba(80,80,80,.1);border:line;border-radius:4px;padding:5px;' type='button' value='submit' onclick='reg()'> + `; + } else { + + + emails = res.messages.reverse() + //console.log(res) + console.log(res) + bod = res.bod + if (res.bod == 'body[2]') { + html = true + } + umail() + resolve(res) } - umail() - resolve(res) }) }) return promie @@ -436,7 +461,7 @@ if (getCookie('login_key') == null) { window.location.href = '/' } - await init() + await update() //return //document.getElementsByClassName('loading')[0].style.display = 'none' let xx = document.getElementsByClassName('card')[0] |