From: Shaun McDonald Date: Thu, 11 Dec 2008 15:05:53 +0000 (+0000) Subject: Don't give an error when you access the login page when you are logged in. Instead... X-Git-Tag: live~7601^2~103 X-Git-Url: https://git.openstreetmap.org/rails.git/commitdiff_plain/814822120a6becb634a22e872094b8fa16c3ea4f Don't give an error when you access the login page when you are logged in. Instead take you to the page in the referer or the home page. --- diff --git a/app/controllers/user_controller.rb b/app/controllers/user_controller.rb index b9ed54096..825c92635 100644 --- a/app/controllers/user_controller.rb +++ b/app/controllers/user_controller.rb @@ -117,6 +117,14 @@ 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 + end @title = 'login' if params[:user] email_or_display_name = params[:user][:email]