使用 Devise,我如何在第一次密码更新(或除通常注册之外的操作)时发送确认电子邮件(与注册电子邮件相同)?
问问题
34 次
1 回答
0
我通过在create
方法中添加条件来做到这一点confirmations_controller.rb
def create
self.resource = resource_class.send_confirmation_instructions(resource_params)
yield resource if block_given?
if successfully_sent?(resource)
respond_with({}, location: after_resending_confirmation_instructions_path_for(resource_name))
else
if <condition> then
User.find_by_email(resource.email).send_confirmation_instructions
respond_with({}, location: after_resending_confirmation_instructions_path_for(resource_name))
else
respond_with(resource)
end
end
end
于 2018-05-24T10:15:30.637 回答