summaryrefslogtreecommitdiff
path: root/www/scripts/captcha.js
blob: abe5070f66d40d873ddb69f6a8e470c3e3c58a08 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
const emailUl = document.getElementById("email-list")

async function emailTurnstileSuccess(token) {
	const response = await fetch("https://backend.altafcreator.com/email", {
		method: 'POST',
		headers: {
			'Content-Type': 'application/json',
		},
		body: JSON.stringify({"token": token}),
	});
	
	const result = await response.json();
	
	if (result.status) {
		emailUl.innerHTML = `
<li>For <b>business<span class="desktop"> inquiries</span></b>: <a href="mailto:${result.business}" class="link"><i class="fa-solid fa-envelope"></i> ${result.business}</a></li>
<li>For <span class="desktop">contacting me </span><b>personal<span class="desktop">ly</span></b>: <a href="mailto:${result.personal}" class="link"><i class="fa-solid fa-envelope"></i> ${result.personal}</a></li>
		`;
	} else {
		emailUl.innerHTML = `<li>Invalid CAPTCHA.</li>`
	}
}