ruby on rails - Devise login based on status of the User? -


i using devise gem authentication. in users table there status column active , inactive status. want of type in application controller:

before_filter :check_user_status    def check_user_status     if @current_user.status == "inactive"     #destroy user session     redirect_to new_session_path   end   

user able access controller if active otherwise should redirected login page. want in application controller check_user_status executed first before controller action.

you should check out active_for_authentication? method realize this. @ documentation find out more details , example.


Comments

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -