【问题标题】:How to update account without confirming your password using devise?如何在不使用 devise 确认密码的情况下更新帐户?
【发布时间】:2014-06-25 21:48:14
【问题描述】:

这是问题所在:我正在使用带有设计的 omniauth-facebook,当有人使用 facebook 登录尝试更新照片或其他任何内容时,出现“密码不能为空”的错误。我试图解决这个问题几个小时但找不到方法,我认为最好的方法是让人们无需确认密码即可更新帐户。我知道设计在这里解释了如何做到这一点:
https://github.com/plataformatec/devise/wiki/How-To:-Allow-users-to-edit-their-account-without-providing-a-password
但这对我不起作用,我是 Rails 新手,我认为我做错了什么!有没有人知道如何解决这个问题?

【问题讨论】:

  • 您是否完成了重新配置路线的步骤?除非您有,否则 Devise 不会知道如何使用您的自定义控制器。
  • 是的!我完全按照网站上的方式进行:devise_for :users, :controllers => { :registrations => "registrations" }

标签: ruby-on-rails ruby facebook devise updates


【解决方案1】:

按照这些步骤进行

1) Create one file in config/initializers/
   for example devise_participants_without_password.rb

2) Open devise_participants_without_password.rb and put this code without any change
   module Devise
    module Models
      module Validatable
        def password_required?
         false
        end
      end
    end
   end

希望这会对你有所帮助。

【讨论】:

  • 感谢您的帮助!但我确实做到了,但我仍然得到“当前密码不能为空”:(
猜你喜欢
  • 2016-07-23
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2020-09-14
  • 1970-01-01
  • 2017-10-20
相关资源
最近更新 更多