Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Option to setup a custom username that is different from the email and is still unique for each user #51

Open
luis-fss opened this issue Jan 13, 2024 · 4 comments
Labels

Comments

@luis-fss
Copy link
Contributor

Do you think it is feasible to add an option to configure a custom username that is different from the email and still unique for each user?

I ask because the user can change their email, but in my use case the username could not be changed and it must be something more concise and shorter than an email.

Thanks.

@luis-fss
Copy link
Contributor Author

If it's of interest, I have made a fork with this feature (and some other changes), at first I didn't intend to create a pull request and the code isn't prepared for that (in fact it's a mess, sorry), but I think it demonstrates my idea in this specific feature.

https://github.com/luis-fss/RavenDB.Identity

@JudahGabriel
Copy link
Owner

Do you think it is feasible to add an option to configure a custom username that is different from the email and still unique for each user?

Sure. How do you envision this changing the behavior of Raven.Identity - ID generation being different?

@luis-fss
Copy link
Contributor Author

I don't think any changes are necessary in the ID generation, the UserIdType.UserName option already exists.

What I thought is:

  1. An option to set the UserName different from the user's email, in this case changing the email would not change the UserName along with it;
  2. Enforce UserName-based uniqueness, just like email with the compare/exchange mechanism;
  3. Finally, perhaps add an option to prevent the UserName from being changed, but maybe this responsibility should be left to app/dev.

Personally, I understand that this can generate too much complexity in the code base, especially in the Create(User)Asyn and Update(User)Asyn methods to ensure that the UserName is unique, but I also think it is a valid feature and use case .

@luis-fss
Copy link
Contributor Author

That being said... Of course it's your decision, but don't feel compelled in any way.
This project is already quite useful as it is.
Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants