Users email stored in lowercase in the Server but lookup uses mixed case

Hi. There was a change made last month to store all email in lowercase (which is sensible) speckle-server/users.js at aac7f1b809e0a01960e3306be0fe267f55dab800 · specklesystems/speckle-server · GitHub

However, I’m having issues with logging in because Azure AD calls the findOrCreateUser function speckle-server/users.js at aac7f1b809e0a01960e3306be0fe267f55dab800 · specklesystems/speckle-server · GitHub which doesn’t make the conversion to lowercase

It’s made a bit more complicated as now all the users that were created more than a month ago are not saved as lowercase so the auth works.

What’s the best solution? Migrate all current users to have lowercase email and update the findOrCreate function? Convert to lowercase in the Azure AD strategy?

@gergo you might know the best way to implement this?

On second thoughts, saving the user’s email as lowercase is only useful using the local strategy. For the federated logins (GitHub, AzureAD) the user won’t enter an email address so saving as lowercase isn’t an issue. I’ve created a PR just altering the local strategy to show what I mean.

With this fix I can use any of the strategies successfully now.

Hey @peter.grainger good catch, this case is unfortunately is :bug: -ed.

Regarding the implementation, i would be happier, if all email storage would be consistent, and no undocumented edge cases were left in the implementation.

But lets continue this on the PR discussions, I think there is an easy fix for it.

1 Like