English 中文(简体)
D.Devise - 改写认证——钥匙改为:在升级后从善后-自称-无效电子邮件或密码错误
原标题:Devise - changed authentication_keys to :login after upgrade from restful_authentication - invalid email or password error

我最近对我的铁路机体进行了升级,从沉积的“美丽”中设计,而设计的标志页(用电子邮件浏览)。 我不想通过电子邮件进行认证,但当我对使用模式的标识进行认证时,它就不再发挥作用,我有以下错误:

Invalid email or password.

Devise.rb

config.authentication_keys = [ :login ]

用户b

class User < ActiveRecord::Base

  devise :database_authenticatable, :registerable,
         :recoverable, :rememberable, :validatable, :trackable,
         :encryptable, :encryptor => :restful_authentication_sha1
  attr_accessible :login, :email, :password, :password_confirmation, :remember_me, :twitter_name, :twitter_id, :atoken, :asecret

纽约总部

  = form_tag session_path, :class =>  enter_form  do
    %label.form_label_small{:for => "login", :style => "color: #336699"} username
    %br/
    = text_field_tag  login , @login, :class =>  input_style_state , :style =>  width: 250px; 
    .clear{:style =>  height: 4px }
    %label.form_label_small{:for => "password", :style => "color: #336699"} password
    %br/
    = password_field_tag  password , nil, :style =>  width: 250px; 
    .clear{:style =>  height: 4px }
    %p{:style => "padding: 0; margin:0;"}
      = check_box_tag  remember_me ,  1 , @remember_me, :style =>  padding: 0; margin: 0; border: 0 
      = label_tag  remember_me ,  remember me 
    .clear{:style => "height: 8px"} 
    %a.button.submit_form{:href =>  /login }
      %span{:style =>  width: 40px }
        login

我与另一个项目存在同样的问题。 我想象:log是否成功地作为认证钥匙,错误信息将说错误的标识或密码无效,而后是无效的电子邮件或密码。

任何关于如何阻止这种失败的想法? 我的错误记录没有说什么。 此处为:

Started POST "/users/sign_in" for 127.0.0.1 at Thu Nov 10 13:46:13 -0500 2011
  Processing by Devise::SessionsController#create as HTML
  Parameters: {"authenticity_token"=>"AMole3YOhXPuOQGX27W1Mr7c18XR1Xk9DUF6JvstbZA=", "utf8"=>"✓", "user"=>{"remember_me"=>"0", "login"=>"aressidi", "password"=>"[FILTERED]"}}
  User Load (0.4ms)  SELECT `users`.* FROM `users` WHERE `users`.`login` =  aressidi  LIMIT 1
  NavAd Load (0.3ms)  SELECT `nav_ads`.* FROM `nav_ads`
Completed   in 34ms
  Processing by Devise::SessionsController#new as HTML
  Parameters: {"authenticity_token"=>"AMole3YOhXPuOQGX27W1Mr7c18XR1Xk9DUF6JvstbZA=", "utf8"=>"✓", "user"=>{"remember_me"=>"0", "login"=>"aressidi", "password"=>"[FILTERED]"}}
问题回答

错误信息是动态生成的,因此错误信息必然表明它正在研究错误的认证领域。 见http://asciicasts.com/episodes/210-customizing-devise”rel=“nofollow”http://asciicasts.com/episodes/210-customizing-devise。

还注意到你再次使用的废墟。 脱硫似乎正确使用它。 一旦我转回Rub.1.9.2,它即立即开始工作。





相关问题
rails collection_select vs. select

collection_select and select Rails helpers: Which one should I use? I can t see a difference in both ways. Both helpers take a collection and generates options tags inside a select tag. Is there a ...

SSL slowness in EC2

We ve deployed our rails app to EC2. In our setup, we have two proxies on small instances behind round-robin DNS. These run nginx load balancers for a dynamically growing and shrinking farm of web ...

Auth-code with A-Za-z0-9 to use in an URL parameter

As part of a web application I need an auth-code to pass as a URL parameter. I am currently using (in Rails) : Digest::SHA1.hexdigest((object_id + rand(255)).to_s) Which provides long strings like : ...

RubyCAS-Client question: Rails

I ve installed RubyCAS-Client version 2.1.0 as a plugin within a rails app. It s working, but I d like to remove the ?ticket= in the url. Is this possible?

activerecord has_many :through find with one sql call

I have a these 3 models: class User < ActiveRecord::Base has_many :permissions, :dependent => :destroy has_many :roles, :through => :permissions end class Permission < ActiveRecord::...

Ordering a hash to xml: Rails

I m building an xml document from a hash. The xml attributes need to be in order. How can this be accomplished? hash.to_xml

Text Editor for Ruby-on-Rails

guys which text editor is good for Rubyonrails? i m using Windows and i was using E-Texteditor but its not free n its expired now can anyone plese tell me any free texteditor? n which one is best an ...

How to get SQL queries for each user where env is production

I’m developing an application dedicated to generate statistical reports, I would like that user after saving their stat report they save sql queries too. To do that I wrote the following module: ...

热门标签