- cache_sweeper :user_sweeper, :only => [:account, :hide, :unhide, :delete]
+ cache_sweeper :user_sweeper, :only => [:account, :set_status, :delete], :unless => STATUS == :database_offline
+
+ def terms
+ @legale = params[:legale] || OSM.IPToCountry(request.remote_ip) || DEFAULT_LEGALE
+ @text = OSM.legal_text_for_country(@legale)
+
+ if request.xhr?
+ render :update do |page|
+ page.replace_html "contributorTerms", :partial => "terms", :locals => { :has_decline => params[:has_decline] }
+ end
+ else
+ @title = t 'user.terms.title'
+ @user = User.new(params[:user]) if params[:user]
+
+ if @user
+ if @user.invalid?
+ render :action => :new
+ elsif @user.terms_agreed?
+ redirect_to :action => :account, :display_name => @user.display_name
+ end
+ else
+ redirect_to :action => :login, :referer => request.request_uri
+ end
+ end
+ end