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

Create a side-effect free method to check db for username availability #32

Closed
NiloCK opened this issue Aug 6, 2018 · 1 comment
Closed

Comments

@NiloCK
Copy link
Owner

NiloCK commented Aug 6, 2018

User registration should provide feedback on the availability of usernames. Current implementation of availability attempts to load a db in a given name and read from it. This ends up CREATING this user-db - an unintended side effect.

Avenues:

NiloCK added a commit that referenced this issue Jan 7, 2019
this isn't working, but I'd rather leave it here to preserve the train
of thought.
@NiloCK
Copy link
Owner Author

NiloCK commented Jan 14, 2019

Better approach:

From https://stackoverflow.com/questions/52269374/how-to-check-if-the-db-exists-in-couchdb-or-not:

You could evaluate the db name from de user name and then check the existence with this API operation:

HEAD /userdb-{hex encoded username}

If the users are managed by your application and are not defined in couch, you can just check the database existence using your db naming rule

In practice: Head requests fail w/ 401 - unauthorized if the name is taken, and 404 - not found if the name is available.

image

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

1 participant