X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/354a57a9fc2d356cd1f75fef4fb319cfeec07b94..61e51f88cc0242dadd3939cd0bbb5197a21cfb94:/app/controllers/user_controller.rb diff --git a/app/controllers/user_controller.rb b/app/controllers/user_controller.rb index 42a50582e..1bab42266 100644 --- a/app/controllers/user_controller.rb +++ b/app/controllers/user_controller.rb @@ -18,11 +18,29 @@ class UserController < ApplicationController cache_sweeper :user_sweeper, :only => [:account, :set_status, :delete] + def terms + @title = t 'user.new.title' + @user = User.new(params[:user]) + + @legale = params[:legale] || OSM.IPToCountry(request.remote_ip) || APP_CONFIG['default_legale'] + @text = OSM.legal_text_for_country(@legale) + + if request.xhr? + render :update do |page| + page.replace_html "contributorTerms", :partial => "terms" + end + elsif @user.invalid? + render :action => 'new' + end + end + def save @title = t 'user.new.title' 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]) @@ -31,6 +49,7 @@ class UserController < ApplicationController @user.description = "" if @user.description.nil? @user.creation_ip = request.remote_ip @user.languages = request.user_preferred_languages + @user.terms_agreed = Time.now.getutc if @user.save flash[:notice] = t 'user.new.flash create success message'