+ if params[:confirm_action]
+ token = UserToken.find_by_token(params[:confirm_string])
+ if token and !token.user.active?
+ @user = token.user
+ @user.active = true
+ @user.email_valid = true
+ @user.save!
+ token.destroy
+ flash[:notice] = 'Confirmed your account, thanks for signing up!'
+ session[:user] = @user.id
+ redirect_to :action => 'account', :display_name => @user.display_name
+ else
+ @notice = 'Something went wrong confirming that user.'
+ end
+ end
+ end
+
+ def confirm_email
+ if params[:confirm_action]
+ token = UserToken.find_by_token(params[:confirm_string])
+ if token and token.user.new_email?
+ @user = token.user
+ @user.email = @user.new_email
+ @user.new_email = nil
+ @user.active = true
+ @user.email_valid = true
+ @user.save!
+ token.destroy
+ flash[:notice] = 'Confirmed your email address, thanks for signing up!'
+ session[:user] = @user.id
+ redirect_to :action => 'account', :display_name => @user.display_name
+ else
+ @notice = 'Something went wrong confirming that email address.'
+ end
+ end
+ end
+
+ def upload_image
+ @user.image = params[:user][:image]
+ @user.save!
+ redirect_to :controller => 'user', :action => 'view', :display_name => @user.display_name
+ end
+
+ def delete_image
+ @user.image = nil
+ @user.save!
+ redirect_to :controller => 'user', :action => 'view', :display_name => @user.display_name
+ end
+
+ def api_details
+ render :text => @user.to_xml.to_s, :content_type => "text/xml"
+ end
+
+ def api_gpx_files
+ doc = OSM::API.new.get_xml_doc
+ @user.traces.each do |trace|
+ doc.root << trace.to_xml_node() if trace.public? or trace.user == @user
+ end
+ render :text => doc.to_s, :content_type => "text/xml"
+ end
+
+ def view
+ @this_user = User.find_by_display_name(params[:display_name], :conditions => "visible = 1")
+
+ if @this_user
+ @title = @this_user.display_name