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

Fixes underscore treated as wildcard in emails #178

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

markstuart
Copy link

In a project we are using this module, and having issues with users unable to sign up if their email address has an underscore in it and closely matches an existing email in the system. After a bit of digging, I found that the LIKE operator in Postgres and MySQL uses underscore as a single character wildcard.

It seems the SilverStripe ORM's 'nocase' modifier must use a LIKE query under the hood, at least in MySQL backends.

Email addresses like 'me2@me.com' and 'm_2@me.com' should not match, but they do with filter('Email:nocase'

The 'nocase' modifier must use a LIKE query under
the hood, at least in MySQL backends. Emails like
'me2@me.com' and 'm_2@me.com' should not match,
but they do with `filter('Email:nocase'`
@michalkleiner
Copy link

That is probably more a framework issue.

@markstuart
Copy link
Author

Agreed, nocase should escape underscores using a backslash most likely. However, this library needs to ensure that a lookup for an email address doesn't accidentally match someone else's email as well I think?

@michalkleiner
Copy link

Yes, thought when fixed in the framework this problem wouldn't exist here. Or is there more to it than the likely required escaping?

@markstuart
Copy link
Author

Raised issue on Silverstripe Framework: silverstripe/silverstripe-framework#10074

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.

2 participants