设计登录不处理

时间:2013-09-16 17:50:37

标签: ruby-on-rails authentication devise

所以我有一个使用Devise的应用程序,其中注册(注册#create)正在运行,但登录(sessions #create)无法正常工作。首先,即使所有字段都留空,也不会显示任何验证错误。在所有情况下(正确的登录凭据和不正确的凭据),只需刷新页面而不调用create操作。

会话#new.html.erb

<h2>Sign in</h2>
<%= devise_error_messages! %>
<%= form_for(resource, :as => resource_name, :url => session_path(resource_name), :autocomplete => "off", :class => 'login-form') do |f| %>
<fieldset>
<div class="form-group">
<div><%= f.label :email %><br />
<%= f.email_field :email, :class => 'form-control', :style => 'width: 300px; background-color: white;', :id => 'input', :autofocus => true %></div>
</div>
<div class="form-group">
<div><%= f.label :password %><br />
<%= f.password_field :password, :style => 'width: 300px; background-color: white;', :class => 'form-control', :id => 'input' %></div>
</div>
<div class="form-group">
<% if devise_mapping.rememberable? -%>
<div><%= f.check_box :remember_me, :style => 'width: 300px; background-color: white;', :class => 'form-control', :id => 'input' %> <%= f.label :remember_me %></div>
<% end -%>
</div>
<div><%= f.submit "Sign in", :class => "btn btn-default" %></div>
</fieldset>
<% end %>

日志

Started POST "/users/sign_in" for 127.0.0.1 at 2013-09-16 12:39:27 -0500
Processing by Devise::SessionsController#create as HTML
Parameters: {"utf8"=>"✓", "authenticity_token"=>"jYBcVamyNJDNxIgm6MiO0bBq/G/mMn/1dO4pJNAbm68=", "user"=>{"email"=>"raphi@qmail.com", "password"=>"[FILTERED]", "remember_me"=>"0"}, "commit"=>"Sign in"}
Completed 401 Unauthorized in 1ms
Processing by Devise::SessionsController#new as HTML
Parameters: {"utf8"=>"✓", "authenticity_token"=>"jYBcVamyNJDNxIgm6MiO0bBq/G/mMn/1dO4pJNAbm68=", "user"=>{"email"=>"raphi@qmail.com", "password"=>"[FILTERED]", "remember_me"=>"0"}, "commit"=>"Sign in"}
Rendered devise/shared/_links.erb (0.4ms)
Rendered devise/sessions/new.html.erb within layouts/application (3.4ms)
Completed 200 OK in 98ms (Views: 18.4ms | ActiveRecord: 0.0ms)

日志并没有告诉我太多,我对如何评估/处理这个问题感到有点迷茫。如果有人有任何想法,您的反馈将非常感激。

干杯,

0 个答案:

没有答案