Repository navigation
feat: prevent usernames colliding with known routes - #199
robsimmons wants to merge 1 commit into
Conversation
1d6c3f9 to
0eafc3a
Compare
3952bf3 to
b45f4e4
Compare
5633d29 to
18a6193
Compare
18a6193 to
25ed6f4
Compare
25ed6f4 to
7f75b20
Compare
Vtec234
left a comment
There was a problem hiding this comment.
I think this approach is quite weird. Normally when I attempt to register somewhere with an unavailable, or otherwise malformed, username, something in the UI tells me "this username is taken/forbidden/whatever, please provide another" and often also "here are some suggestions". Here, we approve the registration but just silently modify the username at the backend database layer?
|
I had this reaction at first, too, and I'm still a little on the fence, to be honest. My reason for changing my mind is that normally when I register somewhere, I'm always choosing the username, so it's pretty low friction to be told "that one doesn't work, pick another". Since we are currently automatically taking github id as workbench id, that makes things feel a bit different, but if you want to make the argument that providing an explicit interface for the user to make a choice in the (I expect quite marginal and rare!) case where there's a collsision, maybe we should go that way after all... |
7f75b20 to
359caf7
Compare
359caf7 to
e68d9b3
Compare
|
In all cases where the user is picking a name I definitely want to use the |
e68d9b3 to
4382d71
Compare
This PR does two things:
isAvailableUsername, which allows us to reject already-existing or disallowed usernames. (This doesn't handle race conditions so we're still relying somewhat on the database-level constraint to avoid collision with existing usernames.)findSuitableAlphaNumNamethat tries to find an acceptable name given a function that rejects unacceptable names. When there's a collision, removes any existing numeric postfix and tries to add postfixes starting with 1.Closes #132.