All,
Nolan pointed out a number of problems to me with the salted login
generator. A couple are genuine, and I believe the rest are just due
to documentation issues, so let me expound here.
First, the controller test has two regex''s with hard codes assuming
that the account model class is called ''User.'' I''ll
have a fix for
this today, but in the interim you can change ''user'' to
''account'' or
whatever your model is.
Second, the README DB schema is missing two items that are in the
supplied user_model.erbsql (installed in /db). I''ve also fixed this
for the release later. However, please look at the user_model.erbsql
for the definitive list of fields needed for the generator to work.
The README is missing the following:
deleted INT default 0,
delete_after DATETIME default NULL
and the field ''password'' should be called
''salted_password.''
Finally, I believe the rest of the problems are caused by trying to
include the ''before_filter :login_required'' directly in the
UserController. This should work (I haven''t tested this yet) - but if
you do it, I''m guessing you *must* also include the same code that
the README says to include assuming it is placed in the
ApplicationController class. For example, you would need the
following lines (showing only the pertinent lines to this problem):
require ''user_system''
UserController < ApplicationController
include UserSystem
helper :user
model :user # probably don''t need this if you are including it
directly in this controller
before_filter :login_required
...
end
Bear in mind, though, that the protect? method is provided so that
you can check permissions in a specific controller, so there''s really
no problem including there, unless you have lots of controllers with
unprotected actions and you want to avoid the filter invocation.