Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #19230
| Path | csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!newsreader4.netcologne.de!news.netcologne.de!newsfeed.arcor.de!newsspool2.arcor-online.net!news.arcor.de.POSTED!not-for-mail |
|---|---|
| Content-Type | text/plain; charset="UTF-8" |
| Message-ID | <7867864.kBbL0iy7tU@PointedEars.de> (permalink) |
| From | Thomas 'PointedEars' Lahn <PointedEars@web.de> |
| Reply-To | Thomas 'PointedEars' Lahn <usenet@PointedEars.de> |
| Organization | PointedEars Software (PES) |
| Date | Thu, 11 Apr 2013 20:40:25 +0200 |
| User-Agent | KNode/4.8.5 |
| Content-Transfer-Encoding | 8Bit |
| X-Face | %i>XG-yXR'\"2P/C_aO%~;2o~?g0pPKmbOw^=NT`tprDEf++D.m7"}HW6.#=U:?2GGctkL,f89@H46O$ASoW&?s}.k+&.<b';Md8`dH6iqhT)6C^.Px|[=M@7=Ik[_w<%n1Up"LPQNu2m8|L!/3iby{-]A+#YE}Kl{Cw$\U!kD%K}\2jz"QQP6Uqr],./"?;=4v |
| Face | iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAGFBMVEXTxa4RFk5dUWANED8PFEfy7+MGBiW+n3ZNF/QuAAACaElEQVQ4jVXUwVOcMBQG8Dc7Rc4PUntdWV2uxjDpGaGeozOp1woar4jd5t/v9wLstMwsA/ntlxdCAgUc1hjTc9/JCZfGoo3wG3HdmdAWrIJRHe7GM/TmpY5VFefuVcAkkPbLIaN8rmPmjloyZxgyR3GuJ4K0AGtJ2htz8o7yqikm759fldQXaMpbDzjKAG+8v+AugVTOPO5DOjLvGtUYQwh0CPjnVMyGd+8/GfUB5nLKJDD2aLDh5HYyMDJGDwQIo2ZmZcKbowNmAdB/AzyFhrmF2MHRb0QJJfaAnwGB6orZhoykLzJtGwF/xpYxI1dswomiUj3gTuAIqCn/4C7cULwGNBtwMTk3Y4LfKB5YUaOKBKYtpplm7u0vip8tU1NWWyI/7XdcSuIDoMt6rVHMWT0DbjHPGqDqZVSa6zleLcUTcIKLoMv3ueJluALtAo9B302zPPlrtiVScRdCjXvVh3e3JpYa/jjkuC9N+LrBMlz/eAN4eQijX2EdLo6c5tGGHwLyHFtXk89dDGHwCVhG9T0S/j55AhRZgkMCmUQXJ49TnS1wnQDvw0eAh9ICeMmEFbCnPMFzjAvsWoEWEFdYEx+S0MoUZ1gT1wId8+AF3Bl2OoEu906AUHx5VLw/gXYg/x84loOah/2UYNrgiwSwGO7RfUzVBbx/kgpckumGOi6QirtD6gkLTitbnxNol47S2jVc2vsN5kPqaAHT8uUdAJM4v/DanjYOwmUjWznGfwB7sGtAtor5BgofDuzaRj4kSQAqDakTsKORa3Q3xKi3gE1fhl71KRMqrdZ2AWNNg/YOhQyrVBnb+i+nEg4bsDA+egAAAABJRU5ErkJggg== |
| Subject | Re: Restrict a domain on Email Validation |
| Newsgroups | comp.lang.javascript |
| References | <9e42c475-f0f4-4822-98d4-0291745f3447@googlegroups.com> |
| MIME-Version | 1.0 |
| Lines | 101 |
| NNTP-Posting-Date | 11 Apr 2013 20:40:27 CEST |
| NNTP-Posting-Host | 5b4e157a.newsspool3.arcor-online.net |
| X-Trace | DXC=X]S5gmcQ5Aag`45cDR8l?oMcF=Q^Z^V3h4Fo<]lROoRa8kF<OcfhCOk?F<P;FJ26_bDZm8W4\YJNlb@mF9jNikdeIQbgJMhLo0gj_@DQ<e89Gk |
| X-Complaints-To | usenet-abuse@arcor.de |
| Xref | csiph.com comp.lang.javascript:19230 |
Show key headers only | View raw
GarryJones wrote:
^^^^^^^^^^
There should be a space character between first and last name so as not to
appear as a pseudonym and being subject to the respective filters.
> I am currently using this code to validate emailadresses on user forms.
>
> function checkform ( form ){
Code conventions:
function checkForm (form) {
or
function checkForm (form)
{
I prefer the latter in order to tell function expressions and function
declarations apart.
> if
> (!(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/
Wrong, see RFC 5322 (and predecessors newer than RFC 822).
> .test(form.bokept.value))){
.test(form.elements["bokept"].value))
{
> var answer = confirm("Invalid or incorrect email address
^
Unterminated string literal ----------------------------------'
> \n Click Cancel if you want to try again
> \n Click OK if you don't have an email address
> \n Click OK if our system does not allow your email adress
> \n If you click OK we will insert a dummy email address for our
> purposes")
> if (answer){form.bokpap.checked = true;
> form.bokept.value = 'missemail@mydomain.se';
You really do not want to include e-mail addresses (verbatim) in client-side
code. Also, do not use potentially existing domains for dummy values or
examples. Use the “invalid” top-level and “example” top-level and second-
level domains. See RFC 2606.
> return false ;
Convention is: No space before “;”.
> } else {
> form.bokept.focus();
> form.bokept.value = '';
Proprietary referencing; avoid, see above.
> return false ;
See above.
> }
> }
> return true ;
See above.
> }
>
> This has served me well since 2005.
Doubtful, as it does not compile due to syntax errors.
> Now I need to make a change.
>
> I can no longer allow users to use email addresses from a certain domain.
>
> How can I change the script to block all email addresses from @forbidden.*
…
&& !/@forbidden\.[^.]+$/.test(…)
As you can see here, it is not necessary to put the test() call in
parentheses.
> (Where * can be org, com. co.uk, se ...... etc)
>
> ?
>
> Any help greatly appreciated.
Adaptation of the client-side code certainly helps to reduce unnecessary
roundtrips. But you must also check potential addresses server-side to
fulfill the requirement. (You should have done so before.)
--
PointedEars
Twitter: @PointedEars2
Please do not Cc: me. / Bitte keine Kopien per E-Mail.
Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Restrict a domain on Email Validation GarryJones <morack@algonet.se> - 2013-04-11 10:33 -0700
Re: Restrict a domain on Email Validation Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-04-11 20:40 +0200
Re: Restrict a domain on Email Validation Stefan Weiss <krewecherl@gmail.com> - 2013-04-11 20:53 +0200
Re: Restrict a domain on Email Validation Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-04-11 21:09 +0200
Re: Restrict a domain on Email Validation Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-04-11 21:35 +0200
Re: Restrict a domain on Email Validation Stefan Weiss <krewecherl@gmail.com> - 2013-04-11 21:49 +0200
Re: Restrict a domain on Email Validation Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-04-11 22:04 +0200
Re: Restrict a domain on Email Validation Stefan Weiss <krewecherl@gmail.com> - 2013-04-11 23:25 +0200
Re: Restrict a domain on Email Validation Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-04-11 23:31 +0200
Re: Restrict a domain on Email Validation Stefan Weiss <krewecherl@gmail.com> - 2013-04-12 00:23 +0200
Re: Restrict a domain on Email Validation Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-04-12 00:42 +0200
Re: Restrict a domain on Email Validation Stefan Weiss <krewecherl@gmail.com> - 2013-04-13 11:36 +0200
Re: Restrict a domain on Email Validation Scott Sauyet <scott.sauyet@gmail.com> - 2013-04-20 13:30 -0700
Re: Restrict a domain on Email Validation Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-04-12 00:51 +0200
Re: Restrict a domain on Email Validation Dr J R Stockton <reply1300@merlyn.demon.co.uk.invalid> - 2013-04-12 19:36 +0100
Re: Restrict a domain on Email Validation "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2013-04-13 10:40 +0200
csiph-web