From 5b5f0adb438a0c30805eb7adc805f6cdc4e7b599 Mon Sep 17 00:00:00 2001 From: Niko Storni Date: Wed, 4 Mar 2020 19:06:33 +0100 Subject: [PATCH] add verification email resend --- view/template/acquisition/youtube_status.php | 2 +- web/js/yt2/FormValidation.js | 20 ++++++++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/view/template/acquisition/youtube_status.php b/view/template/acquisition/youtube_status.php index 7892ecdd..b2933d8c 100644 --- a/view/template/acquisition/youtube_status.php +++ b/view/template/acquisition/youtube_status.php @@ -143,7 +143,7 @@ You need to provide an email

class="error-block"> - You need to verify your email + You need to verify your email! Click here to resend a verification email

diff --git a/web/js/yt2/FormValidation.js b/web/js/yt2/FormValidation.js index 56dbe7e4..f7688c59 100644 --- a/web/js/yt2/FormValidation.js +++ b/web/js/yt2/FormValidation.js @@ -38,6 +38,26 @@ function submitEditForm() { }); } +function resendVerificationEmail(token, email) { + let data = new FormData(); + data.append("status_token", $.trim($('#status_token').val())); + data.append("email", $.trim($('#email').val())); + + let xhr = new XMLHttpRequest(); + xhr.withCredentials = true; + + xhr.addEventListener("readystatechange", function () { + if (this.readyState === 4) { + console.log(this.responseText); + } + }); + + xhr.open("POST", "http://localhost:8080/yt/resend_verification_email"); + xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); + xhr.setRequestHeader("Accept", "*/*"); + xhr.send(data); +} + function submitDetailsForm() { $("#youtube_claim").submit(function (event) {