ctm / mb2-doc

Mb2, poker software
https://devctm.com
7 stars 2 forks source link

Add more restrictions to nicknames #1367

Closed ctm closed 5 months ago

ctm commented 6 months ago

Prevent some of the other forms of bad usernames that I thought of while working on disallowing Zalgoed ones.

This should be done in conjunction with providing feedback as to why a chosen name is inappropriate (#1366).

ctm commented 5 months ago

I'm finally working on this after going down a rabbit hole with an aborted attempt to cleave Login from Lobby as part of (#1376). Currently, NickError is a struct that only identifies the first invalid character a nick can have. I need to be able to have TryFrom return a container that shows all the errors (so I can let the user know what's going on as part of #1366), so I'll probably just turn NickError into an enum and have the Err variant of TryFrom's Result be a Vec<NickError>. A bitfield would be more space efficient and would automatically prevent any given error from being reported more than once, but it's not worth the effort and this also allows the enum variants to carry additional information, like the minimum number of canonical characters needed…

ctm commented 5 months ago

Done. Deploying shortly.