Overriding devise recoverable

前端 未结 1 1238
长情又很酷
长情又很酷 2021-01-27 16:39

As my reputation is lower than 50, so Im not able to comment below the accepted answer in this post In Rails Devise gem how to modify the send_reset_password_instructions method

相关标签:
1条回答
  • 2021-01-27 17:17

    How about do it in some rails initializer? Your are possibly overwriting the original class/module so all the other methods are gone.

    # config/initalizers/devise.rb
    Devise::Models::Recoverable::ClassMethods.module_eval do
      def send_reset_password_instructions(your, params)
        token = set_reset_password_token
        send_reset_password_instructions_notification(token)
    
        token
      end
    end
    
    0 讨论(0)
提交回复
热议问题