From 2ccbc55236d81d790643265f082475b691a5e6b4 Mon Sep 17 00:00:00 2001 From: Tom Hughes Date: Sun, 12 Oct 2008 23:20:28 +0000 Subject: [PATCH] Log the IP address used to create an account. --- app/controllers/user_controller.rb | 1 + db/migrate/016_add_creation_ip.rb | 9 +++++++++ 2 files changed, 10 insertions(+) create mode 100644 db/migrate/016_add_creation_ip.rb diff --git a/app/controllers/user_controller.rb b/app/controllers/user_controller.rb index df2a799c3..c658b2014 100644 --- a/app/controllers/user_controller.rb +++ b/app/controllers/user_controller.rb @@ -16,6 +16,7 @@ class UserController < ApplicationController @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 :-)
Please note that you won't be able to login until you've received and confirmed your email address." diff --git a/db/migrate/016_add_creation_ip.rb b/db/migrate/016_add_creation_ip.rb new file mode 100644 index 000000000..341566940 --- /dev/null +++ b/db/migrate/016_add_creation_ip.rb @@ -0,0 +1,9 @@ +class AddCreationIp < ActiveRecord::Migration + def self.up + add_column "users", "creation_ip", :string + end + + def self.down + remove_column "users", "creation_ip" + end +end -- 2.43.2