module Devise::Models::Confirmable

def active_for_authentication?

calculate if the confirm time has not expired for this user.
is already confirmed, it should never be blocked. Otherwise we need to
by verifying whether a user is active to sign in or not. If the user
Overwrites active_for_authentication? for confirmation
def active_for_authentication?
  super && (!confirmation_required? || confirmed? || confirmation_period_valid?)
end