Rails 4设计登录表格不发布

时间:2014-06-05 19:12:45

标签: ruby-on-rails devise

挑选别人的项目,无法弄清楚Devise有什么问题。

在提交我的凭据以进行登录后,服务器只返回posts / new.html.haml。 devise_for:用户在路由中,表单只是不发布在任何地方,任何人都有任何想法?

这是在new.html.haml:

%h2 Sign in
= simple_form_for(resource, as: resource_name, url: session_path(resource_name)) do |f|
  .form-inputs
    = f.input :email, required: false, autofocus: true
    = f.input :password, required: false
    = f.input :remember_me, as: :boolean if devise_mapping.rememberable?
  .form-actions
    = f.button :submit, "Sign in"
= render "devise/shared/links"

编辑:

日志:

Started POST "/users/sign_in" for 127.0.0.1 at 2014-06-09 12:05:31 -0700
Processing by Devise::SessionsController#create as HTML
  Parameters: {"utf8"=>"✓", "authenticity_token"=>"Y3lwxvJ3oCyqcjJRW7Y5yWKS7hSDoG5E/1xqxXhFxEE=", "user"=>{"email"=>"test@test.com", "password"=>"[FILTERED]", "remember_me"=>"0"}, "commit"=>"Sign in"}
  [1m[35mUser Load (17.0ms)[0m  SELECT  `users`.* FROM `users`  WHERE `users`.`email` = 'test@test.com'  ORDER BY `users`.`id` ASC LIMIT 1
  [1m[36m (0.1ms)[0m  [1mBEGIN[0m
  [1m[35m (0.1ms)[0m  COMMIT
Completed 401 Unauthorized in 101ms


Started GET "/users/sign_in" for 127.0.0.1 at 2014-06-09 12:05:31 -0700
Processing by Devise::SessionsController#new as HTML
  Rendered devise/shared/_links.haml (0.7ms)
  Rendered devise/sessions/new.html.haml within layouts/application (12.9ms)
Completed 200 OK in 135ms (Views: 133.2ms | ActiveRecord: 0.0ms)

/models/user.rb

class User < ActiveRecord::Base
  # Include default devise modules. Others available are:
  # :confirmable, :lockable, :timeoutable and :omniauthable
  devise :database_authenticatable, :registerable,
         :recoverable, :rememberable, :trackable, :validatable, :confirmable, :lockable, :timeoutable
end

在数据库中:

| id | email                  | encrypted_password                                           | reset_password_token | reset_password_sent_at | remember_created_at | sign_in_count | current_sign_in_at | last_sign_in_at | current_sign_in_ip | last_sign_in_ip | confirmation_token                                               | confirmed_at | confirmation_sent_at | unconfirmed_email | failed_attempts | unlock_token | locked_at | created_at          | updated_at          |

|  4 | test@email.com         | $2a$10$Y86TesRGsEpUEQHVbpf3kOaUxC8rR8dXAdUga1o1ldIkBLumyq2Z2 | NULL                 | NULL                   | NULL                |             0 | NULL               | NULL            | NULL               | NULL            | 7d493c377b5645072f7416c78ac567bd7e3a2481ee4ab2283040c76523ed4d6c | NULL         | 2014-06-11 23:26:22  | NULL              |               0 | NULL         | NULL      | 2014-06-11 23:26:22 | 2014-06-11 23:26:22 |

0 个答案:

没有答案