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 usernames case insensitive #3575 #5783

Merged
merged 15 commits into from
May 15, 2019
Merged

make usernames case insensitive #3575 #5783

merged 15 commits into from
May 15, 2019

Conversation

pdurbin
Copy link
Member

@pdurbin pdurbin commented Apr 23, 2019

connects to #3575

@pdurbin pdurbin marked this pull request as ready for review April 23, 2019 18:29
@coveralls
Copy link

coveralls commented Apr 23, 2019

Coverage Status

Coverage decreased (-0.002%) to 19.685% when pulling cb95216 on 3575-usernames into 5c79354 on develop.

Copy link
Contributor

@sekmiller sekmiller left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to give someone who tries to make a new account with a taken identifier (case-insensitive) an indication/ error message that it's taken (Right now it fails with no feedback). Maybe update the named query countOfIdentifier on AuthenticatedUser to compare on lowercase. We are saving the identifier as whatever the user enters on account creation, but maybe we should allow the user to log in with another case version of his/her identifier.

@pdurbin
Copy link
Member Author

pdurbin commented Apr 25, 2019

Maybe update the named query countOfIdentifier on AuthenticatedUser to compare on lowercase.

Ah, like you did in 95a8086. Thanks! I'll take a look.

@pdurbin
Copy link
Member Author

pdurbin commented Apr 25, 2019

fails with no feedback

Here's the stack trace as of 0a0dc25: stacktrace-0a0dc25.txt

@sekmiller
Copy link
Contributor

When I said no feedback I meant that if you try to create an account that has an identifier that is already taken, but with a different case from the existing account, the save fails at the database level and the user doesn't get an error message. It just fails. and they can hit Save again and wonder why nothing is happening. If you add "LOWER(" to the named query I mentioned above then the user sees an error message of "This username is already taken".

@pdurbin pdurbin requested a review from sekmiller April 25, 2019 15:59
@pdurbin
Copy link
Member Author

pdurbin commented Apr 25, 2019

@sekmiller yes. I get you. Thanks! I just pushed 392d26e. Can you please take a look and move it QA if you feel like we're ready? Thanks!

@sekmiller
Copy link
Contributor

The test for existing usernames on account create looks good.

Also, if we're saying that username is case insensitive we should probably allow you to log in whatever case you like, so if my username is sekmiller I should also be able to log in as SekMiller or SEKMILLER, etc.

@pdurbin
Copy link
Member Author

pdurbin commented Apr 25, 2019

@sekmiller you're saying I should be able to log in with DATAVERSEADMIN. Obviously, this only applies to built-in accounts, not Shib or OAuth.

@djbrooke thoughts?

@scolapasta
Copy link
Contributor

Not Danny, but yes, we should allow this. If we're saying usernames are case insensitive then we should treat them that way functionally. (it's ok to preserve a user's chosen format for presentation). We do the same for dataverse alias, e.g. both dataverse.harvard.edu/dataverse/PSI and dataverse.harvard.edu/dataverse/psi will get you to PIS's dataverse.

@djbrooke
Copy link
Contributor

@pdurbin thanks for tagging me. I think it's fine if people log in with DaTaVeRsEADMIN vs dataverseadmin vs. whatever other capitalization.

Regarding the title of this PR - is there any internationalization/localization concern forcing lower case?

@scolapasta
Copy link
Contributor

@pdurbin @sekmiller one more note - we should basically find all places in the code that look for username and make sure they're case insensitive - create user and user login are the two obvious ones, but another one that comes to mind is when you are assigning roles and looking for the user. (a good approach here would be to look for all the queries that involve username)

@pdurbin pdurbin changed the title make usernames case insensitive (force lower case in database) #3575 make usernames case insensitive #3575 Apr 25, 2019
@pdurbin
Copy link
Member Author

pdurbin commented Apr 25, 2019

I suppose a corollary of all this is that I should be able to use the changeIdentifier API to rename dataverseAdmin to DATAVERSEADMIN. Same case but stored differently in the database.

I'm beginning to feel like this issue needs more definition of done.

@djbrooke
Copy link
Contributor

@pdurbin sounds good! Happy to discuss tomorrow.

@scolapasta
Copy link
Contributor

scolapasta commented Apr 25, 2019

Sure. I think this is lower priority, but at some point someone may want to change it and it should be an easy add. (ChangeUserIdentifierCommand first checks if the newusername already exists, so we could add a 2nd check there to see that if it does, it still allows the change if it's just a case variant of the old username). Should be a one line change.

 if (authenticatedUserTestNewIdentifier != null && !oldIdentifer.toLowerCase().equals(newIdentifier.toLowerCase())) {

allow changeIdentifier to be called on same user (in order to change case of username)
@scolapasta
Copy link
Contributor

I went ahead and made the change, though used slightly different logic:
if (authenticatedUserTestNewIdentifier != null && !authenticatedUserTestNewIdentifier.equals(au)) {

@kcondon
Copy link
Contributor

kcondon commented May 15, 2019

@pdurbin Please update from /develop -version was changed. Thanks!

@pdurbin
Copy link
Member Author

pdurbin commented May 15, 2019

@kcondon sure, done in cb95216

@kcondon kcondon merged commit ea334a6 into develop May 15, 2019
@kcondon kcondon deleted the 3575-usernames branch May 15, 2019 20:13
@kcondon kcondon self-assigned this May 15, 2019
@pdurbin pdurbin added this to the 4.15 milestone Jun 14, 2019
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

Successfully merging this pull request may close these issues.

7 participants