Gossamer Forum
Home : Products : Gossamer Mail : Discussion :

Feature request || bug

Quote Reply
Feature request || bug
Hmm, the forum's interface is getting better and better...

Alex, I've sent you two emails this week from freemail.gossamer-threads.com as user with funny usernames.
I notised, that join.cgi allows users to have usernames that contain not valid characters for email address like ~, ®, ™, etc.
I am not going to use join, and login from GMail (I'll use centralized user database), but for other users would be better if you add some general validation rules for username and password fields.
Some general rules like:
- No characters other than A-Za-z0.-_ (did I miss something?) in username.
- No spaces in password.
- Password cannot be the same as username for obvious reasons.
- Password must be more than 6 characters.
- Better email address validation. Usually I use this regexp:
Code:
/^[A-Z0-9][\-\.\_A-Z0-9]*\@\[?[\-\.A-Z0-9]+\.([A-Z]{2,3}|[^0-9]{1,3})\]?$/i
It's just suggestion and it's really easy to implement in your current application.


rgrdz,
.\\ike
Quote Reply
Re: [TukBa] Feature request || bug In reply to
Quote:
/^[A-Z0-9][\-\.\_A-Z0-9]*\@\[?[\-\.A-Z0-9]+\.([A-Z]{2,3}|[^0-9]{1,3})\]?$/i

You use that for email validation? - yikes........why not go the whole hog and use Email::Valid :)

BTW: You don't need all the escaping inside [] and can use \w instead of A-Z0-9

It's possible to shorten that a whole lot.


Last edited by:

PaulWilson: Sep 13, 2001, 10:52 AM
Quote Reply
Re: [PaulWilson] Feature request || bug In reply to
Well, it works for me Wink.
About escaping - yes, you're right, but nobody's perfect.
About \w.. hmm, not sure, but in some conditions internationalized Perl may include international characters in \w's set which is not good.
Anyway - it's working and I'm happy Wink



rgrdz,
.\\ike
Quote Reply
Re: [TukBa] Feature request || bug In reply to
That regex would block

-email@email.com

......and accept:

bla@[bla.com
Quote Reply
Re: [TukBa] Feature request || bug In reply to
Looks like it would also block anything other than @whatever.xx(x)

Last edited by:

PaulWilson: Sep 13, 2001, 11:19 AM
Quote Reply
Re: [PaulWilson] Feature request || bug In reply to
Blush You're right.. What about this:

/^[\-._A-Z0-9]+\@[\-.A-Z0-9]+\.([A-Z]{2,3}|[^0-9]{1,3})$/i




rgrdz,
.\\ike
Quote Reply
Re: [TukBa] Feature request || bug In reply to
Quote:
/^[\-._A-Z0-9]+\@[\-.A-Z0-9]+\.([A-Z]{2,3}|[^0-9]{1,3})$/i

Getting better...........

Try:

/^[\w.-_]+@[\w-_]+\.\w{2,3}(\.\w{2,3})?$/i

You'd have to test if you can fool it with something fake because I've not tested.

Last edited by:

PaulWilson: Sep 13, 2001, 11:47 AM
Quote Reply
Re: [PaulWilson] Feature request || bug In reply to
Of course none of those handle

foo@mail.gossamer-threads.com

It's very hard to try and limit emails as many that are not valid RFC email addresses will actually get delivered properly. I can create a pop account .@gossamer-threads.com and it will work fine.

Now whether you want free email clients to create that is another matter. I'll look at making the regex easily accessible.

Cheers,

Alex
--
Gossamer Threads Inc.
Quote Reply
Re: [Alex] Feature request || bug In reply to
Quote:
Of course none of those handle

foo@mail.gossamer-threads.com

Could be easily made to by adding a period inside [] after @

Last edited by:

PaulWilson: Sep 14, 2001, 3:42 AM
Quote Reply
Re: [PaulWilson] Feature request || bug In reply to
Yes, but then foo@..com is valid. Wink

Cheers,

Alex
--
Gossamer Threads Inc.