+ 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?
+ if @user.new_record?
+ render :action => :new
+ else
+ flash[:errors] = @user.errors
+ redirect_to :action => :account, :display_name => @user.display_name
+ end
+ elsif @user.terms_agreed?
+ redirect_to :action => :account, :display_name => @user.display_name
+ end
+ else
+ redirect_to :action => :login, :referer => request.request_uri
+ end