简体   繁体   English

如何调试devise / warden?

[英]How to debug devise/warden?

I am trying to setup devise in my rails app. 我正在尝试在我的rails应用程序中设置设计。 It was working nicely, but now I am not able to login as any of my users I get 'Invalid email or password.' 它工作得很好,但现在我无法以我的任何用户身份登录“电子邮件或密码无效”。 I would like to get more insight why its not authenticating. 我想更深入地了解它为什么不进行身份验证。

Is there any devise configuration settings that shed some more light? 是否有任何设计配置设置可以更轻松? ie what is the query being used to find the user, et c ... 即用于查找用户的查询是什么,等等...

Thanks! 谢谢!

Normally Devise not provide an accurate logging system, maybe overriding the default controller you can catch what is going wrong. 通常设计不提供准确的日志记录系统,可能会覆盖默认控制器,您可以捕获出错的地方。 Try something like this: 尝试这样的事情:

# app/controllers/sessions_controller.rb
class SessionsController < Devise::SessionsController
  def new
    super # or perform some custom task
  end

end 

Remember then to configure the routes too. 记住然后也要配置路由。

# app/config/routes.rb
devise_for :users, :controllers => {:sessions => "sessions"}

For more details about the default Devise sessions controller take a look at this: https://github.com/plataformatec/devise/blob/master/app/controllers/devise/sessions_controller.rb 有关默认Devise会话控制器的更多详细信息,请查看以下内容: https//github.com/plataformatec/devise/blob/master/app/controllers/devise/sessions_controller.rb

OR 要么

You can login with ssh to your remote server, run rails console and do manually some checks (check that users exist, try a login via console,...), alternatively you can create a rake task with some testing and run remotely. 您可以使用ssh登录到远程服务器,运行rails console并手动执行一些检查(检查用户是否存在,尝试通过控制台登录,...),或者您可以通过一些测试创建rake任务并远程运行。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM