Add contributor's email validation
This commit is contained in:
parent
bb84db00c0
commit
47542c397f
1 changed files with 9 additions and 0 deletions
|
@ -249,6 +249,11 @@ on_show_add_contributor_modal=function(e) {
|
||||||
$('#add_contributor_modal #add_contributor_name').focus();
|
$('#add_contributor_modal #add_contributor_name').focus();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
validateEmail=function(email) {
|
||||||
|
var re = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
|
||||||
|
return re.test(email);
|
||||||
|
}
|
||||||
|
|
||||||
on_valid_add_contributor_modal=function(e) {
|
on_valid_add_contributor_modal=function(e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
var group=groups[$('#add_contributor_modal').data('group-uuid')];
|
var group=groups[$('#add_contributor_modal').data('group-uuid')];
|
||||||
|
@ -268,6 +273,10 @@ on_valid_add_contributor_modal=function(e) {
|
||||||
alert('Un contributor utilise déjà cet email !');
|
alert('Un contributor utilise déjà cet email !');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (!validateEmail(email)) {
|
||||||
|
alert('Email invalide !');
|
||||||
|
return;
|
||||||
|
}
|
||||||
if(edit_id=='-1') {
|
if(edit_id=='-1') {
|
||||||
group.addContributor(new Contributor(name,email));
|
group.addContributor(new Contributor(name,email));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue