Enable signup

This commit is contained in:
aboutDavid 2023-04-30 20:28:27 +00:00
parent 1bab4a077f
commit db150f7cb8
4 changed files with 27 additions and 5 deletions

View File

@ -1 +1 @@
<!doctype html><html lang="en-US"><head><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/holiday.css@0.11.0"></head><body><h1>email.radio</h1><p>email.radio is dedicated to providing free email hosting for all licensed ham radio operators. You will get a (free!) email @email.radio address.</p><p>A magical signup form will appear here on May 3rd, 2023.</p><input placeholder="Callsign" id="call" oninput="updateEmail()"><p id="email">Your email will be</p><button disabled="disabled">This button will enable on the 3rd!</button><script>function updateEmail(){document.querySelector("#email").innerHTML=`Your email will be ${document.querySelector("#call").value}@email.radio!`}</script></body><footer><small>&copy; email.radio, 2022. All rights reserved</small></footer></html> <!doctype html><html lang="en-US"><head><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/holiday.css@0.11.0"></head><body><h1>email.radio</h1><p>email.radio is dedicated to providing free email hosting for all licensed ham radio operators. You will get a (free!) email @email.radio address.</p><p>A magical signup form will appear here on May 3rd, 2023.</p><input placeholder="Callsign" id="call" oninput="updateEmail()"><br><input placeholder="Your regular email" id="email"><p id="emailf">Your email will be</p><button id="btn" onclick="submit()">Submit!</button><script>function updateEmail(){document.querySelector("#emailf").innerHTML=`Your email will be ${document.querySelector("#call").value}@email.radio!`}function submit(){document.querySelector("#btn").disabled=!0;var e=document.querySelector("#call").value,l=document.querySelector("#email").value;fetch(`https://signup.email.radio/signup?email=${l}&callsign=`+e).then(e=>e.json()).then(e=>{e.success?alert("Please check your email for more information. Your callsign will be validated before your mailbox is created. This may take up to 48 hours."):(document.querySelector("#btn").disabled=!1,alert(e.error))})}</script></body><footer><small>&copy; email.radio, 2022. All rights reserved</small></footer></html>

2
index.js Normal file
View File

@ -0,0 +1,2 @@
const execSync = require('child_process').execSync;
code = execSync('npm dev');

View File

@ -7,11 +7,30 @@ layout: base.njk
<p>A magical signup form will appear here on May 3rd, 2023.</p> <p>A magical signup form will appear here on May 3rd, 2023.</p>
<input placeholder="Callsign" id="call" oninput="updateEmail()"> <input placeholder="Callsign" id="call" oninput="updateEmail()">
<p id="email">Your email will be</p> <br>
<button disabled>This button will enable on the 3rd!</button> <input placeholder="Your regular email" id="email">
<p id="emailf">Your email will be</p>
<button id="btn" onclick="submit()">Submit!</button>
<script> <script>
function updateEmail(){ function updateEmail(){
document.querySelector("#email").innerHTML = `Your email will be ${document.querySelector("#call").value}@email.radio!` document.querySelector("#emailf").innerHTML = `Your email will be ${document.querySelector("#call").value}@email.radio!`
}
function submit(){
document.querySelector("#btn").disabled = true
var call = document.querySelector("#call").value
var email = document.querySelector("#email").value
fetch(`https://signup.email.radio/signup?email=${email}&callsign=${call}`)
.then(res=>res.json())
.then(res=>{
if (!res.success){
document.querySelector("#btn").disabled = false
alert(res.error)
} else {
alert("Please check your email for more information. Your callsign will be validated before your mailbox is created. This may take up to 48 hours.")
}
})
} }
</script> </script>

View File

@ -4,7 +4,8 @@
"description": "", "description": "",
"main": "index.js", "main": "index.js",
"scripts": { "scripts": {
"start": "npx @11ty/eleventy --serve --port=8080", "start": "npx @11ty/eleventy && npx http-serve _site -p 3070",
"dev": "npx @11ty/eleventy --serve --port=8080",
"build": "npx @11ty/eleventy", "build": "npx @11ty/eleventy",
"test": "echo \"Error: no test specified\" && exit 1" "test": "echo \"Error: no test specified\" && exit 1"
}, },