Created
December 6, 2017 23:40
-
-
Save nfreear/f8cd25c77b84dc8c047acf99edb4fcf3 to your computer and use it in GitHub Desktop.
Burner / disposable email validation test.
This file contains 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> <title> * Burner email test </title> | |
<style> | |
body, input, button { color: #222; font: 1.1rem sans-serif; margin: 1em auto; max-width: 40em; } | |
h1 { font-weight: normal; } | |
form { background: #fdfdfd; border: 1px solid #ccc; border-radius: 5px; padding: 2px 1em; } | |
input { x-border-radius: 3px; min-width: 16em; padding: 2px 6px; } | |
:invalid { border: 1px solid red; } | |
input:invalid { background: #fee; } | |
</style> | |
<h1> Burner email validation test </h1> | |
<form> | |
<p><label>Email address | |
<input name="email" type="email" required value="example@yopmail.com" /> | |
</label> | |
<p><button type="submit">Submit</button> | |
</form> | |
<script src="https://unpkg.com/jquery@3.2.1/dist/jquery.min.js"></script> | |
<script> | |
window.jQuery(function ($) { | |
var $form = $('form'); | |
$form.on('submit', function (ev) { | |
ev.preventDefault(); | |
var $email = $(ev.target).find('[ name = email ]'); | |
$.getJSON('https://www.deaguard.eu.org/email/' + $email.val()) | |
.done(function (data) { | |
console.warn('Disposable email?', data); | |
if (data.disposable) { | |
$email[ 0 ].setCustomValidity('Disposable / burner email addresses are not accepted.'); | |
$form[ 0 ].reportValidity(); | |
} | |
}); | |
}); | |
}); | |
</script> | |
<pre> | |
© Nick Freear, 06-Dec-2017. | |
* https://www.deaguard.eu.org/ | |
* https://github.com/nfreear/burner-email-providers | |
</pre> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment