]> git.openstreetmap.org Git - rails.git/commitdiff
Log the IP address used to create an account.
authorTom Hughes <tom@compton.nu>
Sun, 12 Oct 2008 23:20:28 +0000 (23:20 +0000)
committerTom Hughes <tom@compton.nu>
Sun, 12 Oct 2008 23:20:28 +0000 (23:20 +0000)
app/controllers/user_controller.rb
db/migrate/016_add_creation_ip.rb [new file with mode: 0644]

index df2a799c35c8aa6ccfe4a92e1b1e3f736e3f10b9..c658b201412a5bf2dda750e292458b38c945c1aa 100644 (file)
@@ -16,6 +16,7 @@ class UserController < ApplicationController
     @user.visible = true
     @user.data_public = true
     @user.description = "" if @user.description.nil?
     @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."
 
     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."
diff --git a/db/migrate/016_add_creation_ip.rb b/db/migrate/016_add_creation_ip.rb
new file mode 100644 (file)
index 0000000..3415669
--- /dev/null
@@ -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