Devise 2.2.4와 함께 Rails 3.2.13을 설치했습니다. 기본 devise 설정 (config.mail_sender 제외)을 사용하고, erb에서 slim으로 변환 된 뷰를 변환했습니다. 이제 이상한 버그가 있습니다 : 사용자가 등록 할 수 있으며, 비밀번호를 복원 할 수 있지만 로그인 할 수 없습니다!Devise : 로그인 할 수 없습니다 (Unauthorized 401)
로그 :
Started POST "https://stackoverflow.com/users/sign_in" for 188.186.102.147 at 2013-07-14 17:58:42 +0400
Processing by Devise::SessionsController#create as HTML
Parameters: {"utf8"=>"✓", "authenticity_token"=>"eqZ9zAUWn+blmhNMTi3iqhjX9ac1N8EaXpqNMyp/fYw=", "user"=>{"email"=>"[email protected]", "password"=>"[FILTERED]", "remember_me"=>"1"}, "commit"=>"Войти"}
Completed 401 Unauthorized in 1ms
Processing by Devise::SessionsController#new as HTML
Parameters: {"utf8"=>"✓", "authenticity_token"=>"eqZ9zAUWn+blmhNMTi3iqhjX9ac1N8EaXpqNMyp/fYw=", "user"=>{"email"=>"[email protected]", "password"=>"[FILTERED]", "remember_me"=>"1"}, "commit"=>"Войти"}
Rendered devise/shared/_links.slim (3.8ms)
Rendered devise/sessions/new.html.slim within layouts/application (59.6ms)
Completed 200 OK in 208ms (Views: 83.6ms | ActiveRecord: 1.4ms)
설정/초기화/devise.rb :
Devise.setup do |config|
config.mailer_sender = "[email protected]"
require 'devise/orm/active_record'
config.case_insensitive_keys = [ :email ]
config.strip_whitespace_keys = [ :email ]
config.skip_session_storage = [:http_auth]
config.stretches = Rails.env.test? ? 1 : 10
config.reconfirmable = true
config.password_length = 8..128
config.reset_password_within = 6.hours
config.sign_out_via = :delete
end
모델 : 사용자 테이블의
class User < ActiveRecord::Base
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :trackable, :validatable
attr_accessible :email, :password, :password_confirmation, :remember_me
devise :database_authenticatable, :registerable,
:recoverable, :trackable, :rememberable, :validatable
attr_accessible :email, :password, :password_confirmation, :remember_me
end
덤프 :
CREATE TABLE `users` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`email` varchar(255) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
`encrypted_password` varchar(255) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
`reset_password_token` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
`reset_password_sent_at` datetime DEFAULT NULL,
`remember_created_at` datetime DEFAULT NULL,
`sign_in_count` int(11) DEFAULT '0',
`current_sign_in_at` datetime DEFAULT NULL,
`last_sign_in_at` datetime DEFAULT NULL,
`current_sign_in_ip` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
`last_sign_in_ip` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
`created_at` datetime NOT NULL,
`updated_at` datetime NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `index_users_on_email` (`email`),
UNIQUE KEY `index_users_on_reset_password_token` (`reset_password_token`)
) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
LOCK TABLES `users` WRITE;
INSERT INTO `users` VALUES (1,'[email protected]','$2a$10$tLC/NVBIa3cyI0HkiaZ7O.oXKTZ/jVm/L8jDMsSQ27CzNWcefWkCm',NULL,NULL,NULL,2,'2013-07-14 15:49:29','2013-07-14 12:37:07','188.186.102.147','188.186.102.147','2013-07-14 12:37:07','2013-07-14 15:49:29');
UNLOCK TABLES;
아무도 도와 줄 수 있습니까?
401 오류는 대개 필요한 인증이 실패했거나 제공되지 않았 음을 나타냅니다. http://en.wikipedia.org/wiki/List_of_HTTP_status_codes – David
잘못된 로그인 (전자 메일) 또는 암호를 입력했습니다. 작성한 사용자가 있습니까? 플래시 메시지가 뭐라 구요? –
한 명의 사용자 (본인)가 있으며 정확한 로그인과 비밀번호를 사용합니다 (복사하여 붙여 넣기를 시도했습니다). 잘못된 사용자 이름 또는 암호에 대한 플래시 메시지가 표시되었습니다. – ertaquo