public
Description: My money tracking app. There are many like it, but this one is mine.
Clone URL: git://github.com/dustin/money.git
Search Repo:
Don't error on unauthenticated admin page views, either.
dustin (author)
Mon May 26 18:52:27 -0700 2008
commit  c2b201d3b18eb7354faec1f57b8309ab2994b058
tree    5bbab08a36b6466bb1804aa7276314766da68a41
parent  f9d995f39b80f4c8023e12f29f9f1c461d81e16b
...
94
95
96
97
 
98
99
100
101
102
 
 
 
 
 
 
103
104
...
94
95
96
 
97
98
99
100
 
 
101
102
103
104
105
106
107
108
0
@@ -94,11 +94,15 @@ class AdmController < ApplicationController
0
   end
0
 
0
   def authorized?
0
- current_user.admin?
0
+ logged_in? && current_user.admin?
0
   end
0
 
0
   def access_denied
0
- # XXX: Should probably find a good place for this document.
0
- render :template => 'report/access_denied'
0
+ if logged_in?
0
+ # XXX: Should probably find a good place for this document.
0
+ render :template => 'report/access_denied'
0
+ else
0
+ redirect_to login_path
0
+ end
0
   end
0
 end
...
56
57
58
 
 
 
 
 
 
59
60
61
...
56
57
58
59
60
61
62
63
64
65
66
67
0
@@ -56,6 +56,12 @@ class AdmControllerTest < Test::Unit::TestCase
0
     assert User.authenticate('quentin', 'test'), 'Password changed!'
0
   end
0
 
0
+ def test_reset_not_logged_in
0
+ post :reset_password, :user => 'quentin'
0
+ assert_redirected_to login_path
0
+ assert User.authenticate('quentin', 'test'), 'Password changed!'
0
+ end
0
+
0
   def test_rjs_delete
0
     login_as :quentin
0
     assert_difference 'MoneyTransaction.count', -1 do

Comments

    No one has commented yet.