X-Git-Url: https://git.openstreetmap.org/rails.git/blobdiff_plain/4b2ac2ea2b4f914a87537c099f699a5351f22d82..67292724441a7a447a9ea579a36dee64825dedaf:/app/controllers/user_controller.rb diff --git a/app/controllers/user_controller.rb b/app/controllers/user_controller.rb index 2e2571952..43a6db790 100644 --- a/app/controllers/user_controller.rb +++ b/app/controllers/user_controller.rb @@ -22,10 +22,14 @@ class UserController < ApplicationController @title = t 'user.new.title' @user = User.new(params[:user]) - country_code = params[:legale] || OSM.IPToCountry(request.remote_ip) - @text = OSM.legal_text_for_country(country_code) + @legale = params[:legale] || OSM.IPToCountry(request.remote_ip) || APP_CONFIG['default_legale'] + @text = OSM.legal_text_for_country(@legale) - if @user.invalid? + if request.xhr? + render :update do |page| + page.replace_html "contributorTerms", :partial => "terms" + end + elsif @user.invalid? render :action => 'new' end end @@ -35,6 +39,8 @@ class UserController < ApplicationController if Acl.find_by_address(request.remote_ip, :conditions => {:k => "no_account_creation"}) render :action => 'new' + elsif params[:decline] + redirect_to t 'user.terms.declined' else @user = User.new(params[:user])