99 lines
4.0 KiB
Handlebars
99 lines
4.0 KiB
Handlebars
<div class="row justify-content-center">
|
|
<div class="col-md-8 col-lg-6">
|
|
<div class="card bg-dark border-primary">
|
|
<div class="card-header bg-primary text-white">
|
|
<h3 class="mb-0">Register for API Access</h3>
|
|
</div>
|
|
<div class="card-body">
|
|
<form id="registerForm">
|
|
<div class="mb-3">
|
|
<label for="email" class="form-label">Email address</label>
|
|
<input type="email" class="form-control" id="email" name="email" required>
|
|
<div class="form-text">We'll send a verification link to this email.
|
|
<p>You're email will be deleted after verification.<br>
|
|
<b>Remember your password! No resets will be allowed.</b></p>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="mb-3">
|
|
<label for="username" class="form-label">Username</label>
|
|
<input type="text" class="form-control" id="username" name="username" required>
|
|
</div>
|
|
|
|
<div class="mb-3">
|
|
<label for="password" class="form-label">Password</label>
|
|
<input type="password" class="form-control" id="password" name="password" required>
|
|
</div>
|
|
|
|
<div class="mb-3">
|
|
<label for="confirm_password" class="form-label">Confirm Password</label>
|
|
<input type="password" class="form-control" id="confirm_password" name="confirm_password" required>
|
|
</div>
|
|
|
|
<div class="mb-3 form-check">
|
|
<input type="checkbox" class="form-check-input" id="terms" required>
|
|
<label class="form-check-label" for="terms">I agree to the <a href="/terms">Terms of Service</a> and <a href="/privacy">Privacy Policy</a></label>
|
|
</div>
|
|
|
|
<button type="submit" class="btn btn-primary" id="registerButton">Register</button>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
{{#section 'scripts'}}
|
|
<script>
|
|
$('#registerButton').click(function(e) {
|
|
e.preventDefault();
|
|
const email = $('#email').val();
|
|
const username = $('#username').val();
|
|
const password = $('#password').val();
|
|
const confirm_password = $('#confirm_password').val();
|
|
const terms = $('#terms').is(':checked');
|
|
|
|
if (password !== confirm_password) {
|
|
Swal.fire({
|
|
title: 'Error',
|
|
text: 'Passwords do not match',
|
|
icon: 'error'
|
|
});
|
|
return;
|
|
}
|
|
|
|
if (!terms) {
|
|
Swal.fire({
|
|
title: 'Error',
|
|
text: 'You must agree to the Terms of Service and Privacy Policy',
|
|
icon: 'error'
|
|
});
|
|
return;
|
|
}
|
|
|
|
console.log(email, username, password);
|
|
|
|
$.ajax({
|
|
url: '/auth/register',
|
|
type: 'POST',
|
|
data: { email, username, password },
|
|
success: function(response) {
|
|
Swal.fire({
|
|
title: 'Success',
|
|
text: `You have been registered successfully!<br>
|
|
Your invite code is only good for 12 hours.
|
|
<br>Please check your email for verification.
|
|
<br>Check your spam folder if you don't see it in your inbox.`,
|
|
icon: 'success'
|
|
});
|
|
},
|
|
error: function(xhr) {
|
|
const errorMessage = xhr.responseJSON?.error || 'An error occurred while registering. Please try again.';
|
|
Swal.fire({
|
|
title: 'Error',
|
|
text: errorMessage,
|
|
icon: 'error'
|
|
});
|
|
}
|
|
});
|
|
});
|
|
</script>
|
|
{{/section}} |