Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I'm amazed that we're still having this discussion. It's not that hard:

1. Use regexes for client-side validation to catch typos and warn the user against potential problems without having to round-trip to the server

2. Check DNS records on the server side and send a confirmation mail

The client-side regular expression can be as simple as /@/, but something more complex like

  /^("(\\"|[^"])*"|[^@\s]+)@([A-Za-z0-9-]+\.)*[A-Za-z0-9-]+$/
is fine - even if you mess up the regex, that's not a big deal as long as you allow the user to send the form anyway, probably after asking if he really knows what he's doing...


Your client side regular expression doesn't take IDNs into account.


That's because it's pre-IDN (and it fails for IP address literals as well).

This actually strengthens one of the points I was trying to make: the need to fail gracefully. The application I took the snippet from (which has been retired some years ago) would have accepted IDNs after asking the user for confirmation.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: