X-Git-Url: https://git.openstreetmap.org/rails.git/blobdiff_plain/3296514ab8067ebd9758f18a2349d40d6fa3585e..a0e8c35c1b3bfba11a755d9f8e282fc0773d953f:/app/controllers/user_controller.rb diff --git a/app/controllers/user_controller.rb b/app/controllers/user_controller.rb index 64e1e157d..fd8fff4dc 100644 --- a/app/controllers/user_controller.rb +++ b/app/controllers/user_controller.rb @@ -53,7 +53,7 @@ class UserController < ApplicationController end def lost_password - if params[:user][:email] + if params[:user] and params[:user][:email] user = User.find_by_email(params['user']['email']) if user user.token = User.make_token @@ -63,6 +63,8 @@ class UserController < ApplicationController else flash[:notice] = "Couldn't find that email address, sorry." end + else + render :action => 'lost_password' end end @@ -95,7 +97,11 @@ class UserController < ApplicationController u.timeout = 1.day.from_now u.save session[:token] = u.token - redirect_to :controller => 'site', :action => 'index' + if params[:next_controller] and params[:next_action] + redirect_to :controller => params[:next_controller], :action => params[:next_action] + else + redirect_to :controller => 'site', :action => 'index' + end return else flash[:notice] = "Couldn't log in with those details" @@ -113,7 +119,11 @@ class UserController < ApplicationController end end session[:token] = nil - redirect_to :controller => 'site', :action => 'index' + if params[:next_controller] and params[:next_action] + redirect_to :controller => params[:next_controller], :action => params[:next_action] + else + redirect_to :controller => 'site', :action => 'index' + end end def confirm