X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/b77c6fe8ae31b582e68f3d58391176e43b523023..63e9c4771a02ecf69a692df3a6df3d236b0c214b:/app/controllers/user_controller.rb?ds=sidebyside diff --git a/app/controllers/user_controller.rb b/app/controllers/user_controller.rb index 72d60a307..97b0de73c 100644 --- a/app/controllers/user_controller.rb +++ b/app/controllers/user_controller.rb @@ -1,6 +1,7 @@ class UserController < ApplicationController layout :choose_layout + before_filter :disable_terms_redirect, :only => [:terms, :save, :logout, :api_details] before_filter :authorize, :only => [:api_details, :api_gpx_files] before_filter :authorize_web, :except => [:api_details, :api_gpx_files] before_filter :set_locale, :except => [:api_details, :api_gpx_files] @@ -55,7 +56,10 @@ class UserController < ApplicationController elsif params[:decline] if @user @user.terms_seen = true - @user.save + + if @user.save + flash[:notice] = t 'user.new.terms declined', :url => t('user.new.terms declined url') + end if params[:referer] redirect_to params[:referer] @@ -511,4 +515,13 @@ private 'site' end end + + ## + # + def disable_terms_redirect + # this is necessary otherwise going to the user terms page, when + # having not agreed already would cause an infinite redirect loop. + # it's .now so that this doesn't propagate to other pages. + flash.now[:skip_terms] = true + end end