Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #18023
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!eternal-september.org!feeder.eternal-september.org!news.swapon.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail |
|---|---|
| From | "Mel Smith" <med_cutout_syntel@aol.com> |
| Newsgroups | comp.lang.javascript |
| Subject | Re: ScreenName validation |
| Date | Tue, 8 Jan 2013 13:05:57 -0700 |
| Lines | 76 |
| Message-ID | <al3chaFgp06U1@mid.individual.net> (permalink) |
| References | <al347sFepchU1@mid.individual.net> <53ccd13b-a933-4bbc-ba0a-7061cc9064cd@4g2000yqv.googlegroups.com> |
| X-Trace | individual.net 9snaUnTxLk8zjYZGiDeQzAPvAghy6378XnP3xu30cN1rdBze4Yf28PJqmoEuXN51fI |
| Cancel-Lock | sha1:agbPB7dHc0TpfI4FNnMsnmmxs5U= |
| X-Priority | 3 |
| X-MSMail-Priority | Normal |
| X-Newsreader | Microsoft Outlook Express 6.00.2900.5931 |
| X-MimeOLE | Produced By Microsoft MimeOLE V6.00.2900.6157 |
| X-RFC2646 | Format=Flowed; Original |
| Xref | csiph.com comp.lang.javascript:18023 |
Show key headers only | View raw
Scott said:
This should be easy. And a regex to match that might be something
like:
/^[a-z\.\_\-]{2,12}$/
Thanks for the Regex. I'll test it on my system (and also convert it to my
server language too
> At the server, I will add a 4-digit value to the chosen screenname,
> giving the screen name some uniquity, and return the corrected screen name
> to the client.
Is "uniquity" the combination of "uniqueness" and "iniquity"? :-)
Is this mandatory or just a suggested alternative in case the chosen
name is taken? If mandatory, I'd suggest you might want to rethink
this. People really don't want to have to remember extra arbitrary
numbers.
> If the user leaves the screenname field blank, I will create a
> screenname from the given and surnames (which are mandatory input fields).
> These names will be checked against a national Names database for
> verification.
Irrelevant, I think to your question, but ok.
> The final screen name will be something like:
>
> mel_s1234 // for a blank input
>
> or
>
> snow.bird1234 // where the user has entered " SNOW Bird"
Now you're confusing me. You're allowing the user to enter blank
space and uppercase converting it to your preferred form? You're
moving away from the sweet spot of simple regex. And it's not clear
if you're talking about something that you want to do client-side or
server-side. This is straightforward:
var f = function(s) {
return s.replace(/^\s+|\s+$/g, "").replace(/\s/g,
".").toLowerCase();
}
f(" SNOW bird") // "snow.bird";
but it's not clear to me if this is something that should be done
server-side anyway.
HI Scott:
As noted above, I'll use the validation technique on the server too
before passing back the corrected modified screenname. I'd like to allow
the client to completely pick his own screen name but quickly there will be
dups, obscene, grotesque, etc names abounding. My upper bound of the number
of registrants should be well below 130K people.
The 4 digits represent a code from the client's login IP Address (which
I'm saving in my database of registrants). This allows *many* Joe Smiths
to show on the screen, and allows my server programs to detect muiltple
registrations from spammers. I take a combination of the 1st digits of each
of the octets of the IP address then mix and stir to create this 4-digit
code.
I'm still not settled in my mind as to how to do this, but I know (from
past experience) I'm going to be attacked by the loonies, and I have to
start somewhere to set up my defences :)
Thanks again for the Regex and the straight-forward function above !
-Mel
Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
ScreenName validation "Mel Smith" <med_cutout_syntel@aol.com> - 2013-01-08 10:44 -0700
Re: ScreenName validation Scott Sauyet <scott.sauyet@gmail.com> - 2013-01-08 11:02 -0800
Re: ScreenName validation "Mel Smith" <med_cutout_syntel@aol.com> - 2013-01-08 13:05 -0700
Re: ScreenName validation Eric Bednarz <bednarz@fahr-zur-hoelle.org> - 2013-01-11 01:28 +0100
Re: ScreenName validation Jeff North <jnorthau@yahoo.com.au> - 2013-01-11 12:23 +1100
Re: ScreenName validation Stefan Weiss <krewecherl@gmail.com> - 2013-01-11 03:38 +0100
Re: ScreenName validation Eric Bednarz <bednarz@fahr-zur-hoelle.org> - 2013-01-11 20:35 +0100
Re: ScreenName validation Eric Bednarz <bednarz@fahr-zur-hoelle.org> - 2013-01-11 21:22 +0100
Re: ScreenName validation Stefan Weiss <krewecherl@gmail.com> - 2013-01-11 22:09 +0100
Re: ScreenName validation Eric Bednarz <bednarz@fahr-zur-hoelle.org> - 2013-01-11 23:23 +0100
Re: ScreenName validation Stefan Weiss <krewecherl@gmail.com> - 2013-01-12 00:26 +0100
Re: ScreenName validation Eric Bednarz <bednarz@fahr-zur-hoelle.org> - 2013-01-12 00:54 +0100
Re: ScreenName validation Eric Bednarz <bednarz@fahr-zur-hoelle.org> - 2013-01-12 00:22 +0100
Re: ScreenName validation Scott Sauyet <scott.sauyet@gmail.com> - 2013-01-11 13:29 -0800
Re: ScreenName validation Eric Bednarz <bednarz@fahr-zur-hoelle.org> - 2013-01-12 02:31 +0100
csiph-web