监狱长认证召回401未授权(Warden authentication recalls 401 Un

2019-09-19 10:02发布

我试图建立色器件具有一个全新的Rails应用程序,我已经使用的Gemfile制定正确安装和捆绑安装

以下使用Rails生成设计出安装色器件:安装

使用Rails生成设计用户创建一个新的模型

耙分贝:迁移到创建用户表

加入devise_for :users do get 'users/sign_out', :to => 'devise/sessions#destroy' end与我的浏览器注销

运行轨道服务器

去为localhost:3000 /用户/ sign_up创建一个新用户

去为localhost:3000 /用户/ SIGN_OUT登录他出去

去为localhost:3000 /用户/ sign_in并尝试登录他再次失败,下面和送我回到登录屏幕没有被登录

Started POST "/users/sign_in" for 127.0.0.1 at 2012-07-13 16:55:28 +0800
  Processing by Devise::SessionsController#create as HTML
  Parameters: {"utf8"=>"✓", "authenticity_token"=>"cbFEP0FJ/e2XYHfub3ZeI7nEX0nCheXzCDs2ner3Zw8=", "newuser"=>{"email"=>"henghong.lee@gmail.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"=>"cbFEP0FJ/e2XYHfub3ZeI7nEX0nCheXzCDs2ner3Zw8=", "newuser"=>{"email"=>"henghong.lee@gmail.com", "password"=>"[FILTERED]", "remember_me"=>"0"}, "commit"=>"Sign in"}
Rendered /Users/Kinnovate/.rvm/gems/ruby-1.9.3-p194/gems/devise-2.1.2/app/views/devise/shared/_links.erb (1.0ms)
Rendered /Users/Kinnovate/.rvm/gems/ruby-1.9.3-p194/gems/devise-2.1.2/app/views/devise/sessions/new.html.erb within layouts/application (4.9ms)
Completed 200 OK in 175ms (Views: 16.5ms | ActiveRecord: 1.3ms)

如何解决已完成401未授权?

Answer 1:

attr_accessor :password 

似乎是问题的原因,因为能想出似乎并不为模型创建加密密码



文章来源: Warden authentication recalls 401 Unauthorized