]> git.openstreetmap.org Git - rails.git/blobdiff - app/controllers/user_controller.rb
Merge branch 'master' into terms
[rails.git] / app / controllers / user_controller.rb
index 9551ac6d8fbdd1e21524a6d1f7065f079c7618b9..2e25719524e0c46c5d0da968831981367ee955f3 100644 (file)
@@ -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'