[Devise] 使用omniAuth註冊後,轉至使用者編輯頁面補填其他資訊
前言
本次需求,在facebook登入後,仍希望轉至使用者編輯頁面,讓使用者補填電話及密碼等資訊,否則該帳號不予以啟動。
override after_sign_in_path_for
class ApplicationController < ActionController::Base protect_from_forgery with: :exception
def after_sign_in_path_for(resource) if resource.phone.nil? edit_user_path else super end end end
參考
- http://stackoverflow.com/questions/32471885/how-does-sign-in-and-redirect-in-devise-work
- https://github.com/plataformatec/devise/wiki/How-To:-redirect-to-a-specific-page-on-successful-sign-in
留言