X-Git-Url: https://git.openstreetmap.org/rails.git/blobdiff_plain/2fc9c8c05bfa4878d0a42d7b9238db67cee2805c..d1727377a817ca66acb65b5c854dad35aed19ac1:/app/controllers/user_controller.rb diff --git a/app/controllers/user_controller.rb b/app/controllers/user_controller.rb index ce0122957..89f35a899 100644 --- a/app/controllers/user_controller.rb +++ b/app/controllers/user_controller.rb @@ -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 @@ -274,6 +282,8 @@ class UserController < ApplicationController else password_authentication(params[:username], params[:password]) end + elsif params[:notice] + flash.now[:notice] = t "user.login.notice_#{params[:notice]}" elsif flash[:notice].nil? flash.now[:notice] = t 'user.login.notice' end