Every time I log in, I get the error msg that the email/password is invalid.
routes:
devise_for :users
devise_scope :users do
get '/users/sign_out' => 'devise/sessions#destroy', :as => :destroy_user_session
post '/users/sign_in' => 'devise/sessions#create', :as => :user_session
end
resources :users
user model:
devise :database_authenticatable, :confirmable, :recoverable, :rememberable, :trackable
attr_accessor :password
attr_accessible :first_name, :last_name, :email, :password, :password_confirmation, :gender, :remember_me
view:
<% if signed_in?(:user) %>
Hi <%= current_user.first_name %>. | Not you? <%= link_to 'Sign out', destroy_user_session_path, :method => :delete %>
<% else %>
<%= link_to 'Sign up', signup_path %> or <%= link_to 'Sign in', user_session_path, :method => :create %>
<% end %>
I tried changing the routes to:
get '/users/sign_in' => 'devise/sessions#new', :as => :new_user_session
and changing the respective paths, but that didn't change anything.
I even changed the code in the view from:
if signed_in?(:user)
to:
if user_signed_in?
and did a combination of these things and nothing is working.
I did ask devise to handle the confirmation as well, which I did by copying the generated link to the browser and it signs me in as the user the first time. It also allows me to change the password via the email confirmation link, which also signs me in upon changing the password. But once I sign out and sign back in, it tells me that the email/password is invalid again.
Can anyone help?
I am using rails 3.0.7, devise 1.4.5, capybara 1.1.1, cucumber 1.0.6, mysql2 0.2.6 and rake 0.8.7 if that helps anyone.
Thanks
EDIT:
To help future users, there is actually nothing wrong with the gem. It works fine. The issue is with my database. For some reason, it is selecting a NULL email from the database instead of pulling the info of the user I am trying to log in. I am figuring out how to fix this now and will update once I figure it out.