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

hoodie.account.signUp({username}) does not lowercase username #115

Open
gr2m opened this issue Aug 31, 2016 · 4 comments
Open

hoodie.account.signUp({username}) does not lowercase username #115

gr2m opened this issue Aug 31, 2016 · 4 comments

Comments

@gr2m
Copy link
Member

gr2m commented Aug 31, 2016

@rmehner is already working on it

@MattCed
Copy link

MattCed commented Sep 7, 2016

Noticed a related problem.
If I have a user {username: "www", password: "www} and then do
hoodie.account.update({username: "Cap"}).then....

I can no longer sign in. Not with www, cap or Cap

@gr2m
Copy link
Member Author

gr2m commented Sep 7, 2016

thanks Matt!

@Sticksword
Copy link

Sticksword commented Nov 26, 2016

Asked in Slack but will also leave the message here for reference.

I’m looking at the sign-up.js file in hoodie-account-client/lib.
Can someone explain what state.validate.call(this, options) means? In the hoodie-tracker-app, the signUp method is called with only one parameter but here, it’s exported with 2 parameters. As far as I can tell for #115 (#115), if the validate.call doesn’t lower case the username/password, then the logic is not there to begin with and needs to be implemented.

@gr2m
Copy link
Member Author

gr2m commented Nov 26, 2016

By default, the validate function does nothing. See docs here: https://github.com/hoodiehq/hoodie-account-client#accountvalidate

The idea is that you can can pass in options.validate when initialising the account API to enforce app-specific rules for your app’s account, e.g. you could enforce that all usernames are email addresses.

This issue is about the problem that username must always be lowercase to avoid authentication issues. For that, the serialise util method should check if attributes.username is a string and if it is, it should lowercase it.

Do you want to try implementing it? For tests, you can adapte the sign in integration test to use upper case letters in username, and make another similar one for sign up and account. Also adapt the update test where we change the username to make sure we send a lowercase there, too.

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

4 participants