about summary refs log tree commit diff
path: root/app/controllers/auth
diff options
context:
space:
mode:
authorRené Klačan <rene@klacan.sk>2017-06-11 02:29:08 +0200
committerEugen Rochko <eugen@zeonfederated.com>2017-06-11 02:29:08 +0200
commitdcf0530218c60ff079ca38d7d3707ac80bde7f97 (patch)
tree97ac2de5c3f9c4a3cd765644c598c818b8a27a95 /app/controllers/auth
parent47338bc13d6a528ada2840431e8115ea91a948a5 (diff)
Make sure email is case insensitive on all places (#3688)
When case insensitivity is enabled via devise's `config.case_insensitive_keys` then `.find_for_authentication` method needs to be used instead of `.find_by` because second mentioned returns `nil` when valid email with different cases is passed.

More info https://github.com/plataformatec/devise/wiki/How-To:-Use-case-insensitive-emails
Diffstat (limited to 'app/controllers/auth')
-rw-r--r--app/controllers/auth/sessions_controller.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/app/controllers/auth/sessions_controller.rb b/app/controllers/auth/sessions_controller.rb
index 79e3da5f9..bc3bd2f4b 100644
--- a/app/controllers/auth/sessions_controller.rb
+++ b/app/controllers/auth/sessions_controller.rb
@@ -27,7 +27,7 @@ class Auth::SessionsController < Devise::SessionsController
     if session[:otp_user_id]
       User.find(session[:otp_user_id])
     elsif user_params[:email]
-      User.find_by(email: user_params[:email])
+      User.find_for_authentication(email: user_params[:email])
     end
   end