Bugzilla – Attachment 3814 Details for
Bug 5685
Validation of email address fields
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Proposed patch
0001-Bug-5685-Email-address-format-validation-for-patr.patch (text/plain), 2.28 KB, created by
Mark G
on 2011-04-07 15:23:09 UTC
(
hide
)
Description:
Proposed patch
Filename:
MIME Type:
Creator:
Mark G
Created:
2011-04-07 15:23:09 UTC
Size:
2.28 KB
patch
obsolete
>From 858df4457c7f6197e8072a1490a799f5ceafc8a0 Mon Sep 17 00:00:00 2001 >From: Mark Gavillet <mark.gavillet@ptfs-europe.com> >Date: Thu, 7 Apr 2011 16:19:05 +0100 >Subject: [PATCH] Bug: 5685 - Email address format validation for patron records > >--- > koha-tmpl/intranet-tmpl/prog/en/js/members.js | 30 ++++++++++++++++++++++++- > 1 files changed, 29 insertions(+), 1 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/js/members.js b/koha-tmpl/intranet-tmpl/prog/en/js/members.js >index 796db0a..ef15c3f 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/js/members.js >+++ b/koha-tmpl/intranet-tmpl/prog/en/js/members.js >@@ -84,6 +84,8 @@ var myDate2=document.form.dateexpiry.value.split ('/'); > > // function to test all fields in forms and nav in different forms(1 ,2 or 3) > function check_form_borrowers(nav){ >+ //alert('email'+document.form.email.value+'\nemailpro:'+document.form.emailpro.value+'\nB_email:'+document.form.B_email.value); >+ > var statut=0; > if (document.form.check_member.value == 1 ) > { >@@ -139,7 +141,33 @@ function check_form_borrowers(nav){ > document.form.nodouble.value=1; > } > } >- >+ >+ //validate email addresses >+ function isValidEmailAddress(emailAddress) { >+ var pattern = new RegExp(/^(("[\w-\s]+")|([\w-]+(?:\.[\w-]+)*)|("[\w-\s]+")([\w-]+(?:\.[\w-]+)*))(@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$)|(@\[?((25[0-5]\.|2[0-4][0-9]\.|1[0-9]{2}\.|[0-9]{1,2}\.))((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\.){2}(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\]?$)/i); >+ return pattern.test(emailAddress); >+ } >+ if (statut!=1) { >+ if (document.form.email.value != 0 && (!isValidEmailAddress(document.form.email.value))) >+ { >+ message=''; >+ statut=1; >+ message_champ+=document.form.email.value+' is not a valid email address\n'; >+ } >+ if (document.form.emailpro.value != 0 && (!isValidEmailAddress(document.form.emailpro.value))) >+ { >+ message=''; >+ statut=1; >+ message_champ+=document.form.emailpro.value+' is not a valid email address\n'; >+ } >+ if (document.form.B_email.value != 0 && (!isValidEmailAddress(document.form.B_email.value))) >+ { >+ message=''; >+ statut=1; >+ message_champ+=document.form.B_email.value+' is not a valid email address\n'; >+ } >+ } >+ > if (statut==1){ > //alert if at least 1 error > alert(message+"\n"+message_champ); >-- >1.5.6.5 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 5685
:
3814
|
3860
|
30829
|
32622
|
32623
|
32624
|
37391
|
37392
|
37393
|
38063
|
38064
|
38065
|
38707
|
38708
|
38709
|
38710
|
38711
|
38715
|
38744
|
38745
|
38746
|
38747