Look up email addresses case insensitively for password resets
If the email address entered is not found then try a case insensitive lookup, and if that finds a single result then use it.
This commit is contained in:
parent
3f5374901e
commit
7b01a8ae82
1 changed files with 9 additions and 1 deletions
|
@ -201,7 +201,15 @@ class UserController < ApplicationController
|
|||
@title = t 'user.lost_password.title'
|
||||
|
||||
if params[:user] and params[:user][:email]
|
||||
user = User.visible.where(:email => params[:user][:email]).first
|
||||
user = User.visible.find_by_email(params[:user][:email])
|
||||
|
||||
if user.nil?
|
||||
users = User.visible.where("LOWER(email) = LOWER(?)", params[:user][:email])
|
||||
|
||||
if users.count == 1
|
||||
user = users.first
|
||||
end
|
||||
end
|
||||
|
||||
if user
|
||||
token = user.tokens.create
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue