mirror of
https://github.com/KevinMidboe/zoff.git
synced 2025-10-29 18:00:23 +00:00
Added url for applying for api-tokens
This commit is contained in:
47
server/public/assets/js/token_apply.js
Normal file
47
server/public/assets/js/token_apply.js
Normal file
@@ -0,0 +1,47 @@
|
||||
$(document).ready(function() {
|
||||
$("#about").modal();
|
||||
$(".help-button-footer").hide();
|
||||
$("#contact").modal();
|
||||
|
||||
$("#contact-container").empty();
|
||||
$("#contact-container").html("Send a mail to us: <a title='Open in client' href='mailto:contact@zoff.me?Subject=Contact%20Zoff'>contact@zoff.me</a>");
|
||||
$("#submit-contact-form").hide();
|
||||
|
||||
$(".token-form").on("submit", function(e) {
|
||||
e.preventDefault();
|
||||
var email = $("#email_address").val();
|
||||
$("#email_address").attr("readonly", true);
|
||||
$(".submit").toggleClass("disabled");
|
||||
$(".full-form-token").removeClass("hide");
|
||||
var captcha_response = grecaptcha.getResponse();
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "/api/apply",
|
||||
data: {
|
||||
email: email,
|
||||
"g-recaptcha-response": captcha_response,
|
||||
},
|
||||
success: function(response) {
|
||||
$(".full-form-token").addClass("hide");
|
||||
if(response != "OK") {
|
||||
$("#email_address").attr("readonly", true);
|
||||
$(".submit").toggleClass("disabled");
|
||||
Materialize.toast("Couldn't send email.", 3000, "red lighten");
|
||||
} else {
|
||||
Materialize.toast("Email sent!", 3000, "green lighten");
|
||||
grecaptcha.reset();
|
||||
}
|
||||
},
|
||||
error: function(response) {
|
||||
$(".full-form-token").addClass("hide");
|
||||
$("#email_address").attr("readonly", false);
|
||||
$(".submit").toggleClass("disabled");
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$('#submit-contact-form').on('click', function(e) {
|
||||
e.preventDefault();
|
||||
$("#contact-form").submit();
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user