-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
invites-sample.ejs
125 lines (115 loc) · 4.56 KB
/
invites-sample.ejs
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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
<%
// Default variables you can use.
const dataSettingsGuildName = data.settingsGuildName;
const dataSettingsGuildMemberCount = data.settingsGuildMemberCount;
const dataSettingsPremiumTier = data.settingsGuildPremiumTier;
const dataSettingsRequestUrl = data.settingsRequestUrl;
const dataRecaptchaSiteKey = data.recaptchaSiteKey;
%>
<!DOCTYPE html>
<!--
_ _ _ _ _ _ _
__| (_)___ ___ ___ _ __ __| | ___| |_ ___ _ __ | | _____ _ __ | |__ ___ | |_
/ _` | / __|/ __/ _ \| '__/ _` | / __| __/ _ \| '_ \| |/ / _ \ '__| | '_ \ / _ \| __|
| (_| | \__ \ (_| (_) | | | (_| | \__ \ || (_) | | | | < __/ | | |_) | (_) | |_
\__,_|_|___/\___\___/|_| \__,_| |___/\__\___/|_| |_|_|\_\___|_| |_.__/ \___/ \__|
Made with love by @mrjackyliang
Fork or contribute at https://liang.nyc/dsb
-->
<html lang="en">
<head>
<title>Join Discord - <%= dataSettingsGuildName %></title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="//code.jquery.com/jquery-3.6.1.min.js" integrity="sha256-o88AwQnZB+VDvE9tvIXrMQaPlFFSUTR+nldQm1LuPXQ=" crossorigin="anonymous"></script>
<script src="//www.google.com/recaptcha/api.js" async defer></script>
<script type="text/javascript">
/**
* On submit.
*
* @param {string} sessionToken - Session token.
*
* @returns {void}
*
* @since 1.0.0
*/
function onSubmit(sessionToken) {
jQuery(($) => {
$.post(`<%= dataSettingsRequestUrl %>`, {
token: sessionToken,
}, (success) => {
console.log('Google reCAPTCHA verification success', success);
$("#messages").html(`<span style="background-color: var(--global-color-success);">Thanks for verifying! Please wait while we redirect you to Discord…</span>`);
setTimeout(() => {
window.location.href = success.url;
}, 1000);
}).fail((fail) => {
console.error('Google reCAPTCHA verification failed', fail);
$("#messages").html(`<span style="background-color: var(--global-color-error);">${fail.responseJSON.error} Please contact your server administrator.</span>`);
});
});
}
</script>
<style>
html {
--global-color-white: #fff;
--global-color-success: #00b74a;
--global-color-error: #f93154;
--global-color-warning: #ffa900;
--global-color-information: #39c0ed;
}
body {
font-family: Helvetica, Arial, sans-serif;
margin: 0;
line-height: 1.5;
}
h1,
h2,
h3,
h4,
h5,
h6 {
margin: 20px 0;
}
p {
margin: 20px 0;
}
#content {
display: flex;
width: 100vw;
height: 100vh;
margin: 20px;
text-align: center;
flex-direction: column;
justify-content: center;
}
#content #messages span {
display: block;
background-color: var(--global-color-information);
color: var(--global-color-white);
margin: 0 0 20px;
padding: 15px;
font-size: 14px;
border-radius: 3px;
}
#content .g-recaptcha div {
margin: auto;
}
</style>
</head>
<body>
<div id="content">
<div id="title">
<h1>Join <%= dataSettingsGuildName %> Discord</h1>
<p>Congratulations! You are now using the <strong>custom</strong> invite template.</p>
</div>
<div id="messages">
<noscript>
<span style="background-color: var(--global-color-warning);">Oops! JavaScript needs to be enabled in your browser before you can join.</span>
</noscript>
</div>
<div id="form">
<div class="g-recaptcha" data-sitekey="<%= dataRecaptchaSiteKey %>" data-callback="onSubmit"></div>
</div>
</div>
</body>
</html>