Skip to content

Case insensitive emails

Justin Tomich edited this page May 17, 2017 · 2 revisions

Email storage

Authenticate uses :email as the user's authentication key. Authenticate stores the user's email address in lower case.

Finding users

Authenticate "normalizes" a user's email address when finding users by downcasing and removing spaces. Note that User.find_by_email(params[:email]) is case sensitive. If you need to find a user, use User.find_by_normalized_email(params[:email]) instead.

Recommendation: run a migration

If you are adding Authenticate to an existing app with existing users, be sure to run a migration to downcase the value of the email column for all existing records in the users table.