Last active
September 30, 2016 07:09
-
-
Save rankun203/d4810335723f811a73251b3b08a4caec to your computer and use it in GitHub Desktop.
A HTML page does the email address verification!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>Test</title> | |
<style> | |
.center { | |
text-align: center; | |
margin: 0 auto; | |
} | |
.hide { | |
display: none; | |
} | |
</style> | |
</head> | |
<body> | |
<div style=" width: 100%; background: #eee;"> | |
<div class="content" style="background: #fff;margin: 0 auto; padding: 50px 10px;"> | |
<div style="text-align: center;padding: 20px;"> | |
<img alt="TORO - Vector Store" | |
src="https://s3-us-west-2.amazonaws.com/giivv-bucket/uploads/Giivv-icon-iOS-512w.png" width=200> | |
<h2 style="font-weight: bold;">Welcome to Giivv</h2> | |
</div> | |
<table style="width: 100%;"> | |
<tr> | |
<td class="center"> | |
<div id="processing" class="processing"> | |
<h4 id="msg" class="msg">Verifying...</h4> | |
<div class="loading"> | |
<img src="https://s3-us-west-2.amazonaws.com/giivv-bucket/uploads/loading.gif" | |
width="50" | |
alt="loading"> | |
</div> | |
</div> | |
</td> | |
</tr> | |
<tr> | |
<td> | |
<div class="when-success hide" style="width: 100%;text-align: center; padding: 20px 0;"> | |
<p style="font-size: 12pt;" id="message" class="message"> | |
Congratulations, Operation successful! | |
</p> | |
</div> | |
<p style="font-size: 11pt;">Sincerely,</p> | |
<p style="font-size: 11pt; font-weight: bold;">Giivv Inc</p> | |
</td> | |
</tr> | |
</table> | |
</div> | |
</div> | |
<script src="https://code.jquery.com/jquery-2.2.3.min.js" | |
integrity="sha256-a23g1Nt4dtEYOj7bR+vTu7+T8VP13humZFBJNIYoEJo=" | |
crossorigin="anonymous"></script> | |
<script> | |
function getParameterByName(name, url) { | |
if (!url) url = window.location.href; | |
name = name.replace(/[\[\]]/g, "\\$&"); | |
var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)"), | |
results = regex.exec(url); | |
if (!results) return null; | |
if (!results[2]) return ''; | |
return decodeURIComponent(results[2].replace(/\+/g, " ")); | |
} | |
function showSuccess(msg, message) { | |
$('.when-success').removeClass('hide'); | |
$('.loading').addClass('hide'); | |
$('#msg').text(msg); | |
$('#message').text(message); | |
} | |
function showError(msg) { | |
$('#msg').text(msg); | |
$('.loading').addClass('hide'); | |
} | |
function verifyEmail(api, token) { | |
$.ajax({ | |
url : api, | |
type : "POST", | |
beforeSend: function (xhr) { | |
xhr.setRequestHeader("Content-Type", "application/json"); | |
xhr.setRequestHeader("Accept", "application/json"); | |
xhr.setRequestHeader("Accept-Language", "en"); | |
}, | |
data : JSON.stringify({token: token}), | |
dataType : "json" | |
}).done(function (data) { | |
var code = data && data.code, | |
msg = data && data.msg; | |
if (code && code === 100) { | |
showSuccess('Email Verified!', 'Enjoy happiness! Your email address has been verified, please login in your app.') | |
} else { | |
showError(msg); | |
} | |
}); | |
} | |
(function () { | |
var url = location.href, | |
verifyEmailAPI = '/rest/v1/donor/verifyEmail', | |
token = getParameterByName('token', url); | |
verifyEmail(verifyEmailAPI, token); | |
})(); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment