0

從文檔我認爲它不應該發送確認電子郵件,但它是這樣做的。如何避免devise_invitable發送確認郵件?

這裏是我的invitable動作設定:

class Users::InvitationsController < Devise::InvitationsController 

def multiple_create 
    if params[:multiple_emails].blank? 
     build_resource 
     render :new, notice: "something went wrong" 
    else 
     params[:multiple_emails].each do |email| 
      User.invite!({email: email}, current_user) # current_user will be set as invited_by 
     end 
     if current_user.errors.empty? 
      set_flash_message :notice, :send_instructions, :email => params[:multiple_emails] 
      respond_with current_user, :location => after_invite_path_for(current_user) 
     else 
      respond_with_navigational(current_user) { render :new } 
     end 
    end 
end 
end 

回答

0

爲了避免色器件確認郵件,你必須排除用戶模型:confirmable選項。

例如,更改:

class User 
    devise :registerable, :confirmable 
end 

要:

class User 
    devise :registerable 
end 
+0

但是如果你想確認沒有邀請的用戶註冊? – daslicious 2015-12-31 21:12:11

-1

devise_invitable repo on github文檔是關於如何跳過發送邀請電子郵件很清楚。如果你想創建的邀請,但沒有發送,您可以設置 skip_invitation爲true

:看看第二代碼片段下使用,這是本文開頭。

+0

昨天我加了一個答案,我不知道它在哪裏!我希望它跳過確認電子郵件,而不是邀請函。我侵入了邀請!方法並添加self.skip_confirmation! – wachichornia 2013-03-20 07:00:22