I added login to my app and storing the sessions in the db. I
un-commented the "config.action_controller.session_store
:active_record_store" line in the environment.rb file, and the :secret
in the application.rb file.
Now, when I try to login I get the error InvalidAuthenticityToken.
Here''s my login form:
<% form_for :user, :url => { :action => ''do_login'' }
do |f| %>
<p>user: <%= f.text_field :user_name %></p>
<p>pass: <%= f.password_field :password %></p>
<%= f.submit ''login'' %>
<% end %>
I checked the markup and the hidden field with the token appears. I''m
baffled on what keep causing this error - and would appreciate any help.
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---
sa 125 wrote:> I added login to my app and storing the sessions in the db. I > un-commented the "config.action_controller.session_store > :active_record_store" line in the environment.rb file, and the :secret > in the application.rb file. > > Now, when I try to login I get the error InvalidAuthenticityToken. > Here''s my login form: > > <% form_for :user, :url => { :action => ''do_login'' } do |f| %> > <p>user: <%= f.text_field :user_name %></p> > <p>pass: <%= f.password_field :password %></p> > <%= f.submit ''login'' %> > <% end %> > > > I checked the markup and the hidden field with the token appears. I''m > baffled on what keep causing this error - and would appreciate any help.I should also mention that the exact error is: ActionController::InvalidAuthenticityTokem in LoginController#do_login -- and in the controller: def do_login if request.post? user = User.authenticate(params[:user_name], params[:password]) if user session[:user_id] = user.id redirect_to home_page else flash.now[:notice] = "Invalid user/password - please try again" end end end thanks. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
i answered to this in your other thread... --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Right, sorry. Thought it might deserve a seperate thread. Here''s the other post if someone wondered here looking for an answer: http://www.ruby-forum.com/topic/179690#786710 -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Possibly Parallel Threads
- ActionController::InvalidAuthenticityToken in LoginController
- bug report: last login time vs PAM in portability release
- Upgrade to 2.0.2: InvalidAuthenticityToken error on 1st POST
- No motd, lastlog, stored pam messages displayed
- protect_from_forgery with db-session (Rails 2.3.2)