X-Git-Url: https://git.openstreetmap.org/rails.git/blobdiff_plain/2ba5067fcfd30d5fad952a54ba02cc1ceb6e715c..e120e59fc0dc6c4a2a09ea8a068b901a8c6ac256:/app/controllers/application_controller.rb diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index d715c618d..6c19b3a52 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -15,6 +15,16 @@ class ApplicationController < ActionController::Base session_expires_automatically redirect_to :controller => "user", :action => "suspended" + + # don't allow access to any auth-requiring part of the site unless + # the new CTs have been seen (and accept/decline chosen). + elsif !@user.terms_seen and flash[:skip_terms].nil? + flash[:notice] = t 'user.terms.you need to accept or decline' + if params[:referer] + redirect_to :controller => "user", :action => "terms", :referer => params[:referer] + else + redirect_to :controller => "user", :action => "terms", :referer => request.request_uri + end end elsif session[:token] @user = User.authenticate(:token => session[:token]) @@ -110,7 +120,7 @@ class ApplicationController < ActionController::Base # if the user hasn't seen the contributor terms then don't # allow editing - they have to go to the web site and see # (but can decline) the CTs to continue. - if REQUIRE_TERMS_SEEN and not @user.terms_seen + if REQUIRE_TERMS_SEEN and not @user.terms_seen and flash[:skip_terms].nil? set_locale report_error t('application.setup_user_auth.need_to_see_terms'), :forbidden end