Server sided mail checking...
This commit is contained in:
3
checkMail.php
Normal file
3
checkMail.php
Normal file
@@ -0,0 +1,3 @@
|
||||
<?php
|
||||
echo shell_exec('./checkmail.sh \'' . $_GET['mailAddress'] . '\'');
|
||||
?>
|
||||
@@ -1,6 +1,5 @@
|
||||
/*globals $,ibuyproperties,window*/
|
||||
|
||||
// R O O T E R
|
||||
ibuyproperties.router=(function(){
|
||||
var allRoutes=[];
|
||||
|
||||
|
||||
@@ -1,16 +1,43 @@
|
||||
<script>
|
||||
function checkEMail(theEmailAddress){
|
||||
return (/^([a-zA-Z0-9_.-])+@(([a-zA-Z0-9-])+.)+([a-zA-Z0-9]{2,4})+$/.test(theEmailAddress));
|
||||
var def = new $.Deferred()
|
||||
|
||||
var patternMatch=(/^([a-zA-Z0-9_.-])+@(([a-zA-Z0-9-])+.)+([a-zA-Z0-9]{2,4})+$/.test(theEmailAddress));
|
||||
if (patternMatch ) {
|
||||
$.ajax({
|
||||
type:"GET",
|
||||
url:"/checkMail.php",
|
||||
dataType:"json",
|
||||
contentType:"application/json",
|
||||
data: { "mailAddress" : theEmailAddress},
|
||||
success:function(msg,jqXHR,status) {
|
||||
console.log("send-success method mailcheck ",msg,jqXHR,status);
|
||||
if (msg.status != "ok") {
|
||||
def.resolve();
|
||||
} else {
|
||||
def.reject(msg);
|
||||
}
|
||||
},
|
||||
error:function(jqXHR,status,error){
|
||||
console.log("send-error method mailcheck ",jqXHR,status,error);
|
||||
def.reject(jqXHR);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
def.reject("{status:'error', msg:'pattern not matching e-mail format.'}")
|
||||
}
|
||||
return def.promise();
|
||||
}
|
||||
|
||||
function nextHandler(){
|
||||
$("#alertInvalidEMail").addClass("hide");
|
||||
if(checkEMail($($('[name="email"]')[0]).val())){
|
||||
checkEMail($($('[name="email"]')[0]).val()).then(function(){
|
||||
window.location="#Sell/page2/";
|
||||
} else {
|
||||
}).fail(function(data){
|
||||
if (ibuyproperties.isDebugMode) { console.log("EMail Wrong"); }
|
||||
$("#alertInvalidEMail").removeClass("hide");
|
||||
}
|
||||
console.error("E-Mail check error",data)
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user