Cysha / module-auth

Authentication Module for Phoenix CMS
2 stars 0 forks source link

potential username validation #21

Closed xLink closed 7 years ago

xLink commented 7 years ago

We need to figure out if we want to allow the full keyboard(?) range of characters as usernames or should we make sure they conform to some kind of validation ?

This is mostly coming up because I am currently adding @ mentions to the Forum BUT this validation concerns the auth module so ..

MantisSTS commented 7 years ago

When you say the full keyboard range of characters, do you mean A-Za-z0-9(+special chars) or do you mean unicode/cyrillic/etc too?

xLink commented 7 years ago

prolly just what en_us/en_gb keyboards can input as "full keyboard range" ...didnt even think about the Cyrillic etc stuff

johnmaguire commented 7 years ago

Emoji?

xLink commented 7 years ago

lol no emojis in usernames @JohnMaguire xD

jimmycook commented 7 years ago

0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_-

for usernames probably just go with that (maybe not even _ - tbh), could even force lowercase or allow case sensitivity but validate against it all lowercase so you don't have the same username (xLink vs xlink vs XLINK for example)

johnmaguire commented 7 years ago

lol no emojis in usernames @JohnMaguire xD

Pfft, well I guess I forgot that the UK isn't a free country! 😆

jimmycook commented 7 years ago

💩⛈ < if you're allowing emoji there's my username

johnmaguire commented 7 years ago

Try ctype_alnum(str_replace(['-', '_'], '', $username)); // bool

xLink commented 7 years ago

0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_-

tis what @richard-clifford suggested on irc too

[a-zA-Z0-9_-] it is :D

johnmaguire commented 7 years ago

💩👍