]> git.openstreetmap.org Git - rails.git/blobdiff - app/controllers/user_controller.rb
Improve handling of login/logout some more to improve the chances of
[rails.git] / app / controllers / user_controller.rb
index f12cb1051dfded38933a49e5fc6d95edc3c2b5ce..83845af42547fcbd50a0a5182704cbcaaf9bf488 100644 (file)
@@ -75,6 +75,7 @@ class UserController < ApplicationController
         pass = User.make_token(8)
         user.pass_crypt = pass
         user.pass_crypt_confirmation = pass
+        user.active = true
         user.save
         Notifier::deliver_reset_password(user, pass)
         flash[:notice] = "Your password has been changed and is on its way to your mailbox :-)"
@@ -98,8 +99,8 @@ class UserController < ApplicationController
         u.timeout = 1.day.from_now
         u.save
         session[:token] = u.token
-        if params[:next_controller] and params[:next_action]
-          redirect_to :controller => params[:next_controller], :action => params[:next_action]
+        if params[:referer]
+          redirect_to params[:referer]
         else
           redirect_to :controller => 'site', :action => 'index'
         end
@@ -120,8 +121,8 @@ class UserController < ApplicationController
       end
     end
     session[:token] = nil
-    if params[:next_controller] and params[:next_action]
-      redirect_to :controller => params[:next_controller], :action => params[:next_action]
+    if params[:referer]
+      redirect_to params[:referer]
     else
       redirect_to :controller => 'site', :action => 'index'
     end