lib/authenticate/user.rb in authenticate-0.2.3 vs lib/authenticate/user.rb in authenticate-0.3.0

- old
+ new

@@ -47,9 +47,21 @@ def reset_session_token! generate_session_token save validate: false end + module ClassMethods + + def normalize_email(email) + email.to_s.downcase.gsub(/\s+/, '') + end + + # We need to find users by email even if they don't use email to log in + def find_by_normalized_email(email) + find_by_email normalize_email(email) + end + + end end end