From 814822120a6becb634a22e872094b8fa16c3ea4f Mon Sep 17 00:00:00 2001 From: Shaun McDonald Date: Thu, 11 Dec 2008 15:05:53 +0000 Subject: [PATCH] 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. --- app/controllers/user_controller.rb | 8 ++++++++ 1 file changed, 8 insertions(+) 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] -- 2.43.2