-
Notifications
You must be signed in to change notification settings - Fork 0
/
activate.html
85 lines (76 loc) · 2.64 KB
/
activate.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Pastor Insights</title>
<link href="index.css" rel="stylesheet"/>
<script>
function getURLParameter(name) {
return decodeURIComponent((new RegExp('[?|&]' + name + '=' + '([^&;]+?)(&|#|;|$)').exec(location.search) || [, ""])[1].replace(/\+/g, '%20')) || null
}
document.addEventListener("DOMContentLoaded", function(event) {
var form = document.getElementById('form');
form.addEventListener('submit', function(e){
e.preventDefault();
activate(new FormData(form));
});
document.getElementById('code').value = getURLParameter('code');
});
function activate(formData) {
document.getElementById('submit').disabled = true;
document.getElementById('submit').innerHTML = "Please wait ...";
form_json = Object.fromEntries(formData);
// form_json['user_id'] = 0;
console.log("formData is:");
console.log(JSON.stringify(form_json));
fetch('https://pastor-insights-service.gaianet.ai/webhook/ahg0lRP83barIc5if7N4/activate/' + form_json['code'], {
method: 'GET',
credentials: "include",
}).then(function(response) {
return response.json();
}).then(function(data) {
console.log(data);
if (data['status']) {
document.getElementById("form").style.display = "none";
document.getElementById("successMsg").style.display = "block";
} else {
var em = document.getElementById("errorMsg");
em.innerHTML = data['message'];
em.style.display = "block";
}
}).catch(error => {
console.error('Error:', error);
document.getElementById("errorMsg").style.display = "block";
});
}
</script>
</head>
<body>
<!-- Hero Section -->
<div class="hero">
<div class="hero-content">
<h1>Spiritual insights just for you</h1>
<div class="message-box" id="successMsg" style="display:none">
Success! You will soon receive personalized Bible insights through emails from us!
</div>
<div class="message-box" id="errorMsg" style="display:none">
Sorry, there is a problem. Please try again
</div>
<form id="form">
<p>Confirm your email address using the activation code you received</p>
<div class="subscribe-box">
<div class="email-and-subscribe">
<input id="code" name="code" readonly>
<button type="submit" id="submit">Next</button>
</div>
</div>
</form>
</div>
</div>
<!-- Footer -->
<footer>
© 2024 Gaia Network. All rights reserved.
</footer>
</body>
</html>