2013-07-09 33 views

回答

1

我通過重寫創建confimations控制器的動作

def create 
    self.resource = resource_class.send_confirmation_instructions(resource_params) 

    if successfully_sent?(resource) 
     flash[:notice] = "Confirmed already, Please try signing in" if resource.confirmed? 
     respond_with({}, :location => after_resending_confirmation_instructions_path_for(resource_name)) 
    else 
     respond_with(resource) 
    end 
    end 

我只是覆蓋在確認用戶的情況下,閃光燈通知該工作

+0

HI先生,我應該把這個代碼? – Angel

0

要決定的第一件事是,如果你真的想要爲確認的用戶留言。這可能允許用戶枚舉(即讓機器人嘗試在您的網站上查找用戶的電子郵件...這就是爲什麼有paranoid mode

如果您確實想要顯示確認消息,則無需重寫你的用戶在資源上已經有錯誤,例如:「已經被確認,請嘗試登錄」,因此你不需要爲此修改flash,你可能只想使用devise_error_messages!(或者你的自己的自定義代碼顯示錯誤的內容)。

希望這有助於。

相關問題