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

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -