Background:
I've inherited an older Rails application which I'm attempting to setup a local copy and have run into a problem with the Authlogic gem used for authentication. The setup is as follows:
- Rails 2.3.18 application which is a legacy application
- Using Authlogic for authentication.
- Unable to create a valid session
Testing:
The application has a User model and it's constructed using the simple steps outlined in AuthLogic Quick Rails example. The login step routes to the UserSessions controller to take the user parameters (login and password), creates a new session then attempts to save the session, like so:
UserSessionsController.rb
....
@user_session = current_account.user_sessions.new(params[:user_session])
if @user_session.save
# login success
....
else
# login failure
end
It's the last step that's failing. And when I check the errors on the @user_session object I'm getting the string "Login is not valid"
Additionally I've tested this via the rails console and followed the instructions as per the article: Working with Authlogic in console. This basically requires that in the console you execute:
Authlogic::Session::Base.controller = Authlogic::ControllerAdapters::RailsAdapter.new(self)
Using this method when I simulate the UserSession creation via a call like:
us=UserSession.new(:login=> "user@gmail.com", :password => "secret")
I get the error: #<UserSession: no credentials provided>
Now in both cases the user identity exists in the DB.
Any tips/suggestions for fault diagnosis would be most welcome !