X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/7e5c998a87ef776276c8015c17cd9e7be79a1692..fe8a330fd6bdc1ee72758a9f40c90db7653ea28d:/app/controllers/user_controller.rb diff --git a/app/controllers/user_controller.rb b/app/controllers/user_controller.rb index 42a50582e..d86c9a4ba 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' @@ -178,7 +197,8 @@ class UserController < ApplicationController elsif User.authenticate(:username => email_or_display_name, :password => pass, :pending => true) flash.now[:error] = t 'user.login.account not active' elsif User.authenticate(:username => email_or_display_name, :password => pass, :suspended => true) - flash.now[:error] = t 'user.login.account suspended' + webmaster = link_to t('user.login.webmaster'), "mailto:webmaster@openstreetmap.org" + flash.now[:error] = t 'user.login.account suspended', :webmaster => webmaster else flash.now[:error] = t 'user.login.auth failure' end