helloGov / webapp

HelloGOV is a call-to-rep campaign link generating tool for organizations engaging in state and federal level legislative advocacy.
https://hellogov.app
MIT License
18 stars 24 forks source link

[#323] Make the email field have a lowercase type to make it case insensitive #330

Closed beekley closed 4 years ago

beekley commented 4 years ago

resolves #323

Motivation and context

Email was case sensitive and the error was confusing if the user used a different capitalization as the admin had entered for their email.

What I did

Pretty much what it says in the title. Signups w/ capital letters that are pending when this gets merged in will be left in stuck state. If there are signups in this state, we'd have to delete/fix those in the DB directly since there's isn't an API.

Inspired by: https://stackoverflow.com/a/13991704

seport commented 4 years ago

looks good! Can you also add a fix on the controller level to make login case insensitive?

beekley commented 4 years ago

We use a library to handle our POST /login route, so it's not easy to change the query we make to validate a user's creds. An alternative is to write a migration that converts all existing User.usernames to lowercase, then adding a similar lowercase: true property, but that's not super easy.