ruby on rails - Is it possible to automatically suspend users in devise? -
there's application uses devise , add possibility automatically suspend account (14 days trial). looking expire devise user found this: https://github.com/phatworx/devise_security_extension doesn't me.
does know way automatically suspend user account after time?
you can test expiration in before_action
class applicationcontroller << actioncontroller::base before_action :check_expiration def check_expiration if current_user && current_user.status == 'trial' if date.today - current_user.created_at.to_date > 14 flash[:error] = "your trial has expired!" sign_out current_user redirect_to :new_session_path end end end end
Comments
Post a Comment