X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/a7d304d20f171030d8a8c5f523c9039a02f832f2..4b2ac2ea2b4f914a87537c099f699a5351f22d82:/app/controllers/user_controller.rb diff --git a/app/controllers/user_controller.rb b/app/controllers/user_controller.rb index 9551ac6d8..2e2571952 100644 --- a/app/controllers/user_controller.rb +++ b/app/controllers/user_controller.rb @@ -18,6 +18,18 @@ class UserController < ApplicationController cache_sweeper :user_sweeper, :only => [:account, :hide, :unhide, :delete] + def terms + @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) + + if @user.invalid? + render :action => 'new' + end + end + def save @title = t 'user.new.title' @@ -31,6 +43,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'