Skip to content
Browse files

Changed user login to send user to admin section on succesful login i…

…nstead of the blog homepage since users have the ability to post to the blog
  • Loading branch information...
1 parent 3700f8d commit e6ef40f48b4d37f18381e8a0ed2dd5a551a7d82b Chris Cummer committed with emk Jan 4, 2009
Showing with 4 additions and 3 deletions.
  1. +2 −1 app/controllers/account_controller.rb
  2. +2 −2 test/functional/account_controller_test.rb
View
3 app/controllers/account_controller.rb
@@ -55,6 +55,7 @@ def activate
protected
def default_url(user)
- admin? ? url_for(:controller => '/admin/overview', :action => 'index') : dispatch_url(:path => [])
+ # If the user can log in then they have permission to act in the admin section (non-admins can post, admins can admin the site)
+ logged_in? ? url_for(:controller => '/admin/overview', :action => 'index') : dispatch_url(:path => [])
end
end
View
4 test/functional/account_controller_test.rb
@@ -38,8 +38,8 @@ def setup
test "should login as site user" do
post :login, :login => 'ben', :password => 'test'
assert session[:user]
- # ben is not an admin so should be redirected to the front page
- assert_redirected_to :controller => 'mephisto', :action => 'dispatch'
+ # ben is not a site admin but as a user ben has the ability to post so direct ben to the admin overview
+ assert_redirected_to :controller => 'admin/overview', :action => 'index'
post :logout
assert !session[:user]
end

0 comments on commit e6ef40f

Please sign in to comment.
Something went wrong with that request. Please try again.