codeforamerica / ohana-api

The open source API directory of community social services.
http://ohana-api-demo.herokuapp.com/api
BSD 3-Clause "New" or "Revised" License
185 stars 344 forks source link

Downcase admin_emails before saving #504

Closed monfresh closed 4 years ago

monfresh commented 4 years ago

Why: In order to determine whether an admin user is able to edit a particular location, their email address is compared to the list of admin_emails associated with the location. When an admin account is created, the email is automatically converted to lowercase. However, when an admin email is added to a location, it does not get converted.

The current comparison looks for an exact match. To fix this issue, we can either fix the comparison to be case insensitive, or automatically convert admin emails to lowercase. The latter is the simplest solution, and is what I implemented here.