X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/b625eefdeb55822c7d4a4dafa6473c8ac537ef48..17323257685bf5134d9286f5baefaddcae65478c:/app/controllers/concerns/session_methods.rb diff --git a/app/controllers/concerns/session_methods.rb b/app/controllers/concerns/session_methods.rb index 5dcddb82d..4bbfac34f 100644 --- a/app/controllers/concerns/session_methods.rb +++ b/app/controllers/concerns/session_methods.rb @@ -39,7 +39,9 @@ module SessionMethods session[:fingerprint] = user.fingerprint session_expires_after 28.days if session[:remember_me] - target = referer || session[:referer] || url_for(:controller => :site, :action => :index) + cookies.delete :_osm_anonymous_notes_count + + target = referer || url_for(:controller => :site, :action => :index) # The user is logged in, so decide where to send them: # @@ -48,7 +50,7 @@ module SessionMethods # - If they were referred to the login, send them back there. # - Otherwise, send them to the home page. if !user.terms_seen - redirect_to :controller => :users, :action => :terms, :referer => target + redirect_to account_terms_path(:referer => target) elsif user.blocked_on_view redirect_to user.blocked_on_view, :referer => target else @@ -56,31 +58,28 @@ module SessionMethods end session.delete(:remember_me) - session.delete(:referer) end ## # process a failed login - def failed_login(message, username = nil) + def failed_login(message, username, referer = nil) flash[:error] = message - redirect_to :controller => "sessions", :action => "new", :referer => session[:referer], + redirect_to :controller => "sessions", :action => "new", :referer => referer, :username => username, :remember_me => session[:remember_me] session.delete(:remember_me) - session.delete(:referer) end ## # - def unconfirmed_login(user) + def unconfirmed_login(user, referer = nil) session[:pending_user] = user.id redirect_to :controller => "confirmations", :action => "confirm", - :display_name => user.display_name, :referer => session[:referer] + :display_name => user.display_name, :referer => referer session.delete(:remember_me) - session.delete(:referer) end ##