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

Make username validation configurable or less restrictive #74

Open
klues opened this issue May 25, 2023 · 1 comment
Open

Make username validation configurable or less restrictive #74

klues opened this issue May 25, 2023 · 1 comment

Comments

@klues
Copy link
Contributor

klues commented May 25, 2023

I've just migrated from superlogin to couch-auth, so first thanks for your work creating an up-to-date version of this framework!

Since the way usernames are stored and database names are chosen is differently in couch-auth (key value in user doc and <prefix><user-id> for database name), I think the validation of the username could be less restrictive:

  • user.ts#L102: I think there would be no problem if a username starts with _
  • util.ts#L13: I think there would be no problem in allowing usernames with uppercase letters or longer than 16 chars

So my proposal would be to just use a regex like /^[A-Za-z0-9_-]{2,50}$/ or to make it configurable.

klues added a commit to asterics/AsTeRICS-Grid that referenced this issue May 25, 2023
@fynnlyte
Copy link
Collaborator

Glad if you're using it!

Yeah, the 16 char limitation most likely comes from an early version of CouchDB and superlogin where the username was identical to the database name. Making it configurable via config.ts + providing the current regex as default sounds reasonable to me.

I think I'll implemented that myself + clean up something else in the key - logic.

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

No branches or pull requests

2 participants