X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/06b8558aaf911d643a7ab986dcc50d40f774d6b6..865d20af80a70929c761e3ea6d1010669bb4ed62:/app/controllers/users_controller.rb?ds=sidebyside diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index b3596b376..1cc27d9d9 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -146,11 +146,11 @@ class UsersController < ApplicationController def lost_password @title = t "users.lost_password.title" - if params[:user] && params[:user][:email] - user = User.visible.find_by(:email => params[:user][:email]) + if params[:email] + user = User.visible.find_by(:email => params[:email]) if user.nil? - users = User.visible.where("LOWER(email) = LOWER(?)", params[:user][:email]) + users = User.visible.where("LOWER(email) = LOWER(?)", params[:email]) user = users.first if users.count == 1 end @@ -183,6 +183,7 @@ class UsersController < ApplicationController if current_user.save token.destroy + session[:fingerprint] = current_user.fingerprint flash[:notice] = t "users.reset_password.flash changed" successful_login(current_user) end @@ -323,6 +324,7 @@ class UsersController < ApplicationController token.destroy session[:user] = user.id + session[:fingerprint] = user.fingerprint redirect_to referer || welcome_path end @@ -366,8 +368,9 @@ class UsersController < ApplicationController else flash[:errors] = current_user.errors end - token.destroy + current_user.tokens.delete_all session[:user] = current_user.id + session[:fingerprint] = current_user.fingerprint redirect_to :action => "account", :display_name => current_user.display_name elsif token flash[:error] = t "users.confirm_email.failure" @@ -552,6 +555,7 @@ class UsersController < ApplicationController # process a successful login def successful_login(user, referer = nil) session[:user] = user.id + session[:fingerprint] = user.fingerprint session_expires_after 28.days if session[:remember_me] target = referer || session[:referer] || url_for(:controller => :site, :action => :index) @@ -642,6 +646,8 @@ class UsersController < ApplicationController end if user.save + session[:fingerprint] = user.fingerprint + set_locale(true) if user.new_email.blank? || user.new_email == user.email