Skip to content

UserModel.setup #2522

Description

@justinwatkins

// Access token to normalize email credentials UserModel.observe('access', function normalizeEmailCase(ctx, next) { if (!ctx.Model.settings.caseSensitiveEmail && ctx.query.where && ctx.query.where.email) { ctx.query.where.email = ctx.query.where.email.toLowerCase(); } next(); });

This code completely chokes if you have case insensitive email on and you try to query the user api by email address using a like query. The ctx.query.where will == {'like': 'someValue'} which is an object and not a string, so .toLowerCase is not defined which cause the entire process to crash.

A simple fix is to check whether toLowerCase exists first and let the consumer deal with making sure the query is all lowercase, or you could do a quick loop over all of the property values and lower case each. If there is a preference, I could create a pull request.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions