@cmdfilter
def otp_filter(self, message, command, args, dry_run):
    '\n\t\tFilter commands to determine if user has recently validated with OTP.\n\t\t'
    with self.lock:
        if (command in self['commands']):
            self.log.info('{0} is protected by OTP. Processing.'.format(command))
            identity = self.get_identity(message)
            secrets = self['secrets']
            if (identity not in secrets):
                self.send_templated(message.frm, 'otp_filter', dict(not_enrolled=True))
                return (None, None, None)
            (_, _, lastotp) = secrets[identity]
            if ((datetime.datetime.now() - lastotp) > _OTP_EXPIRE):
                self.log.info('{0} has not authenticated with OTP since expire'.format(identity))
                self.send_templated(message.frm, 'otp_filter', dict(auth_required=True))
                return (None, None, None)
            self.log.info('OTP ok, permit command.')
        return (message, command, args)
Filter commands to determine if user has recently validated with OTP.
@cmdfilter
def otp_filter(self, message, command, args, dry_run):
    '\n\t\t\n\t\t'
    with self.lock:
        if (command in self['commands']):
            self.log.info('{0} is protected by OTP. Processing.'.format(command))
            identity = self.get_identity(message)
            secrets = self['secrets']
            if (identity not in secrets):
                self.send_templated(message.frm, 'otp_filter', dict(not_enrolled=True))
                return (None, None, None)
            (_, _, lastotp) = secrets[identity]
            if ((datetime.datetime.now() - lastotp) > _OTP_EXPIRE):
                self.log.info('{0} has not authenticated with OTP since expire'.format(identity))
                self.send_templated(message.frm, 'otp_filter', dict(auth_required=True))
                return (None, None, None)
            self.log.info('OTP ok, permit command.')
        return (message, command, args)