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

feat(plugin-users-permissions): auth email case-insensitive #442

Merged
merged 6 commits into from
Jan 23, 2018
Merged

feat(plugin-users-permissions): auth email case-insensitive #442

merged 6 commits into from
Jan 23, 2018

Conversation

lucaperret
Copy link
Contributor

No description provided.

@@ -32,10 +32,11 @@ module.exports = {
const isEmail = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test(params.identifier);

// Set the identifier to the appropriate query field.
const identifier = params.identifier.toLowerCase();
Copy link
Member

Choose a reason for hiding this comment

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

Why do you need to lowercase the identifier at this line? It should only concern the email. Also, if we do that we have to be sure that the stored email is lowercased during the registration process or that our query whatever the connector (strapi-bookshelf, strapi-mongoose) are making a query that is case-insensitive.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The identifier is lowercased here:
d9198dd
Do you prefer to only lowercase the email?

Copy link
Member

Choose a reason for hiding this comment

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

Yes, it's a mistake on our side. We should also remove the spaces, accents, etc by using the _.deburr() method of Lodash. But, we have to keep uppercase characters.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok so I'll apply lowercase only in email field.

Copy link
Member

Choose a reason for hiding this comment

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

@lucaperret Awesome! We will be able to merge after these changes.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok but how to lowercase only the email field ?
Here d9198dd I don't know if it's an email or username...

Copy link
Member

@Aurelsicoko Aurelsicoko Jan 23, 2018

Choose a reason for hiding this comment

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

@lucaperret You have to add this line to the register method

const isEmail = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test(params.identifier);

@Aurelsicoko
Copy link
Member

Thank you for your work @lucaperret! It's great to see active contributor like you 👍

Can you read my comment and come back to us with the necessary updates?

@lucaperret
Copy link
Contributor Author

Done

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.

None yet

3 participants