LoginEngine: undefined method `generate_security_token'


#1

Hi there,

I’m trying to set up LoginEngine with Rails 1.1.2 on Ruby 1.8.4 on a
Windows XP box and the log is reporting:

undefined method `generate_security_token’ for #User:0x39436a0
Rendering user/signup
Rendered user/_edit (0.01600)
Rendered user/_password (0.01600)

Rails appears to be failing on key = @user.generate_security_token in
user_controller.rb in the signup method. The offending block is:

    if @user.save
      key = @user.generate_security_token
      url = url_for(:action => 'home', :user_id => @user.id, :key => 

key)
flash[:notice] = ‘Signup successful!’
if LoginEngine.config(:use_email_notification) and
LoginEngine.config(:confirm_account)
UserNotify.deliver_signup(@user, params[:user][:password],
url)
flash[:notice] << ’ Please check your registered email
account to verify your account registration and continue with the
login.’
else
flash[:notice] << ’ Please log in.’
end
redirect_to :action => ‘login’
end

Initially, I also had undefined method errors for password and
new_password for #<User…>, so I added these fields to the user table.
It seems like the LoginEngine was not correctly installed or at least
the migration 001_initial_schema was incomplete. I can work around with
that, however, this error truly seems like a missing method.

This is my first experience installing an engine. Any help is
appreciated!

Dave


#2

Do you have an existing User model in your application? If so, you
need to include the AuthenticatedUser model in it, as per the docs…

  • james

#3

James A. wrote:

Do you have an existing User model in your application? If so, you
need to include the AuthenticatedUser model in it, as per the docs…

  • james

Thanks James, that’s got it!
Btw, I’ve gone back and looked at the README docs and honestly don’t see
anything about including AuthenticatedUser.

Dave
I’m not a complete idiot, some pieces are missing.