+ else
+ @user = User.new(params[:user])
+
+ @user.visible = true
+ @user.data_public = true
+ @user.description = "" if @user.description.nil?
+ @user.creation_ip = request.remote_ip
+
+ if @user.save
+ flash[:notice] = "User was successfully created. Check your email for a confirmation note, and you\'ll be mapping in no time :-)<br>Please note that you won't be able to login until you've received and confirmed your email address."
+ Notifier.deliver_signup_confirm(@user, @user.tokens.create)
+ redirect_to :action => 'login'
+ else
+ render :action => 'new'
+ end
+ end
+ end
+
+ def account
+ @title = 'edit account'
+ if params[:user] and params[:user][:display_name] and params[:user][:description]
+ if params[:user][:email] != @user.email
+ @user.new_email = params[:user][:email]
+ end
+
+ @user.display_name = params[:user][:display_name]
+
+ if params[:user][:pass_crypt].length > 0 or params[:user][:pass_crypt_confirmation].length > 0
+ @user.pass_crypt = params[:user][:pass_crypt]
+ @user.pass_crypt_confirmation = params[:user][:pass_crypt_confirmation]
+ end
+
+ @user.description = params[:user][:description]
+ @user.home_lat = params[:user][:home_lat]
+ @user.home_lon = params[:user][:home_lon]
+
+ if @user.save
+ if params[:user][:email] == @user.new_email
+ @notice = "User information updated successfully. Check your email for a note to confirm your new email address."
+ Notifier.deliver_email_confirm(@user, @user.tokens.create)
+ else
+ @notice = "User information updated successfully."
+ end
+ end
+ end
+ end
+
+ def set_home
+ if params[:user][:home_lat] and params[:user][:home_lon]
+ @user.home_lat = params[:user][:home_lat].to_f
+ @user.home_lon = params[:user][:home_lon].to_f
+ if @user.save
+ flash[:notice] = "Home location saved successfully."
+ redirect_to :controller => 'user', :action => 'account'
+ end