Slowly figuring out how to get my SaltedHashLoginGenerator stuff
working. The wiki page
says to put “before_filter :login_required” in the user (my “user” is
“member”) controller
or in ApplicationController. However, wherever I put it I get
NoMethodError.
The rest of the SHLG stuff seems to be working… or at least I could
get to the signup
page, register, and confirm my registration from the email it sent. But
the login_required
method – which is in my member_system.rb (“member” is my “user”) –
can’t be found.
Hmm, although, I notice that the MemberSystem module has “protected” at
the top… that
means everything below is protected, right? Would that cause a problem?
(that’s the way it
was generated though, so I doubt it)
Here’s my ApplicationController:
class ApplicationController < ActionController::Base
include Localization
include MemberSystem
helper :member
model :member
before_filter :login_required
end
And here’s some of the lib/member_system.rb:
module MemberSystem
protected
…
login_required filter. add
before_filter :login_required
if the controller should be under any rights management.
for finer access control you can overwrite
def authorize?(member)
def login_required
if not protect?(action_name)
return true
end
if member? and authorize?(@session['member'])
return true
end
# store current location so that we can
# come back after the user logged in
store_location
# call overwriteable reaction to unauthorized access
access_denied
return false
end
…
Any ideas?
thanks,
b