private function resetRateLimit()
    {
        // clear the logs for the current ip/username combo
        LoginRateControlEntity::find(['ip' => $this->ip, 'username' => $this->username])->delete();

        // delete all records older than 30 days
        $ts = time() - (30 * 86400);
        LoginRateControlEntity::find([
            'timestamp' => [
                '$lt' => [$ts]
            ]
        ])->delete();
    }