X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/b99e8702912226ffc9264efaeede2d4d2e3c7156..4b2ac2ea2b4f914a87537c099f699a5351f22d82:/app/controllers/user_controller.rb?ds=inline diff --git a/app/controllers/user_controller.rb b/app/controllers/user_controller.rb index 83c414ef2..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' @@ -209,8 +222,6 @@ class UserController < ApplicationController @user = token.user @user.active = true @user.email_valid = true - @user.terms_agreed = Time.now.getutc - @user.consider_pd = true if params[:consider_pd] @user.save! referer = token.referer token.destroy