Reputation: 16724
My users submit an email and our Oauth provider generates a unique ID. I want to generate a human-friendly username/slug for the users so they don't have to write one.
It's so that they can provide the URL as a linkage to other people. It may also be because we may introduce a "confidential" feature that hides identity but exposes this unique, human-friendly username that is generated for them.
How do I do that?
Upvotes: 0
Views: 456
Reputation: 3267
I'd recommend to make a list of pronounceable syllables and pick 2-4 of them randomly.
The syllables might be:
I'm not so sure about English but this works very well in my language.
Upvotes: 0
Reputation: 16441
Just take the portion of their e-mail before the @
and append a number onto the end of it's already been taken. Given them an option to change it.
Upvotes: 1