]> git.openstreetmap.org Git - rails.git/blobdiff - app/controllers/user_controller.rb
Fix for #1565. Added a couple of tests and fixed another issue with re-used placehold...
[rails.git] / app / controllers / user_controller.rb
index 196d5cea66267c8e552649a6db2fd49320ad021c..7ebe6b6b6f7af8ddcbe3404b3f2b99f64a38b45f 100644 (file)
@@ -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 :-)<br>Please note that you won't be able to login until you've received and confirmed your email address."
@@ -116,6 +117,15 @@ class UserController < ApplicationController
   end
 
   def login
+    if session[:user]
+      # The user is logged in already, if the referer param exists, redirect them to that
+      if params[:referer]
+        redirect_to params[:referer]
+      else
+        redirect_to :controller => 'site', :action => 'index'
+      end
+      return
+    end
     @title = 'login'
     if params[:user]
       email_or_display_name = params[:user][:email]