airblade / quo_vadis

Multifactor authentication for Rails (7 and 6).
MIT License
33 stars 4 forks source link

Cannot Sign in User #3

Closed regdog closed 13 years ago

regdog commented 13 years ago

I have updated to v1.0.7 and signed up a new user(with sign in) successfully. But it failed to sign in this new user with sign-in form. The flash message is "Sorry, we did not recognise you." It shows that the create action of session controller is called correctly. So I checked in console with statement User.authenticate(username, password). It returns my new user successfully. Then, I am confused. I cannot figure out where I am doing wrong.

Here is my sign in form template.

<h1>Sign in</h1>
<%= form_for :session, :url => sign_in_url do |f| %>
  <div class="field">
    <%= f.label :username %><br />
    <%= f.text_field :username %>
  </div>
  <div class="field">
    <%= f.label :password %><br />
    <%= f.password_field :password %>
  </div>
  <div class="actions">
    <%= f.submit "Sign in" %>
  </div>
<% end %>
airblade commented 13 years ago

I suspect the problem is the form_for :session. Please can you replace form_for :session, :url => sign_in_url with form_tag sign_in_url and try it again?

regdog commented 13 years ago

Yeah, the problem is the "form_for :session". Everything works with "form_tag sign_in_url". I got that "form_for" cannot be used here becuase it generated params session[username], session[password], not params[:username], params[:password].

Great thanks!!! :)