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

Convert to lowercase before email lookup #1420

Merged
merged 1 commit into from
Jun 7, 2022
Merged

Conversation

megahirt
Copy link
Collaborator

@megahirt megahirt commented Jun 6, 2022

Description

This fixes an issue where a user could not login because they are accustomed to case-sensitive email addresses. This is a simpler implementation of #1419 , given that we know that all our email addresses are already lowercase.

Fixes #1418

Type of Change

Only keep lines below that describe this change, then delete the rest.

  • Bug fix (non-breaking change which fixes an issue)

Testing on your branch

  • Locally on develop, sign-up for an account and then login using your email address (lowercase). Verify that it works. Now, logout and login with part of the email typed with capital letters e.g. Me@example.com You will get an invalid username/password error.

  • Now on this branch, repeat the testing and verify that capital letters in the email address login field do not make a difference. You should be able to login using e.g. ME@example.com just fine.

Checklist

  • I have performed a self-review of my own code
  • I have reviewed the title/description of this PR which will be used as the squashed PR commit message
  • I have commented my code, particularly in hard-to-understand areas
  • I have added tests that prove my fix is effective or that my feature works

qa.languageforge.org testing

Reviewers: add/replace your name below and check the box to sign-off/attest the feature works as expected on qa.languageforge.org

  • Rick Bartlett (2022-06-09 07:38)
  • Joseph Myers (2022-06-10 9:50)

This fixes an issue where a user could not login because they are accustomed to case-sensitive email addresses.
@github-actions
Copy link

github-actions bot commented Jun 6, 2022

Unit Test Results

373 tests   373 ✔️  11s ⏱️
    1 suites      0 💤
    1 files        0

Results for commit 551c104.

@megahirt
Copy link
Collaborator Author

megahirt commented Jun 6, 2022

My thanks to @rmunn for his PR #1419 which inspired this fix. I had previously attempted a fix using strtolower() in Auth.php but hadn't gotten a working solution yet.

Copy link
Contributor

@longrunningprocess longrunningprocess left a comment

Choose a reason for hiding this comment

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

Doesn't get much simpler, nice one!

Copy link
Collaborator

@rmunn rmunn left a comment

Choose a reason for hiding this comment

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

Agreed, this is better than doing a case-insensitive search with Mongo, because in Mongo that requires using the $regex matcher and emails can have all kinds of characters that have special meanings in regex, such as the widely-used robin.munn+sometag@gmail.com feature. So my solution would have required extensive testing of the regex quoting, whereas if we know that we are already storing all email addresses in lowercased form, then this is better.

@rmunn rmunn merged commit b92397e into develop Jun 7, 2022
@rmunn rmunn deleted the bugfix/lowerCaseEmail branch June 7, 2022 01:40
rmunn added a commit that referenced this pull request Jun 7, 2022
…loyment

This reverts commit b92397e. After
deployment we will revert this revert and restore the feature.
rmunn added a commit that referenced this pull request Jun 7, 2022
…loyment

This reverts the revert of this feature, which can be merged into our
next deployment.
@palmtreefrb
Copy link
Contributor

Tested on QA. No Issues, all tests passed.

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.

bug: login email address field is case sensitive
4 participants