[OzzModz] Login By Country Log

[OzzModz] Login By Country Log 2.1.0 Patch Level 3

No permission to download

Painbaker

Well-known member
@woody
This add-on uses MaxMind's GeoLite2 Geolocation library

Probably your database is outdated

Try to download new version from your Maxmind cabinet (edition: GeoLite2-Country) and manually replace the \internal_data\ozzmodz\countrylogin contents on your forum
 

Joe Link

Well-known member

Joe Link

Well-known member
@Ozzy47

Next update should probably check this notification preference against the "[OzzModz] Login By Country Log: Can view reports" permission (so normal members can't see it) :)

1633794324677.png
 

Joe Link

Well-known member
@Ozzy47

Seeing quite a few of these errors in the ACP after enabling CloudFlare. I updated to the latest DB, but it had no affect. Any ideas?

1646070892951.png

Code:
Server error log

    InvalidArgumentException: The value "159.87.155.161,104.129.198.224" is not a valid IP address. src/addons/OzzModz/CountryLogin/vendor/maxmind-db/reader/src/MaxMind/Db/Reader.php:175

    Generated by: member2891 Feb 27, 2022 at 6:05 PM

Stack trace

#0 src/addons/OzzModz/CountryLogin/vendor/maxmind-db/reader/src/MaxMind/Db/Reader.php(163): MaxMind\Db\Reader->findAddressInTree('159.87.155.161,...')
#1 src/addons/OzzModz/CountryLogin/vendor/geoip2/geoip2/src/Database/Reader.php(232): MaxMind\Db\Reader->getWithPrefixLen('159.87.155.161,...')
#2 src/addons/OzzModz/CountryLogin/vendor/geoip2/geoip2/src/Database/Reader.php(203): GeoIp2\Database\Reader->getRecord('Country', 'Country', '159.87.155.161,...')
#3 src/addons/OzzModz/CountryLogin/vendor/geoip2/geoip2/src/Database/Reader.php(88): GeoIp2\Database\Reader->modelFor('Country', 'Country', '159.87.155.161,...')
#4 src/addons/OzzModz/CountryLogin/Service/Logger.php(53): GeoIp2\Database\Reader->country('159.87.155.161,...')
#5 src/addons/OzzModz/CountryLogin/Service/Logger.php(30): OzzModz\CountryLogin\Service\Logger->getCountryCode()
#6 src/XF/Container.php(276): OzzModz\CountryLogin\Service\Logger->__construct(Object(XF\Pub\App), '159.87.155.161,...')
#7 src/XF/App.php(1708): XF\Container->createObject('OzzModz\\Country...', Array)
#8 src/XF/Container.php(234): XF\App->XF\{closure}('OzzModz\\Country...', Array, Object(XF\Container))
#9 src/XF/App.php(3021): XF\Container->create('service', 'OzzModz\\Country...', Array)
#10 src/addons/OzzModz/CountryLogin/Listener.php(33): XF\App->service('OzzModz\\Country...', '159.87.155.161,...')
#11 src/XF.php(370): OzzModz\CountryLogin\Listener::OzzModz\CountryLogin\{closure}()
#12 src/XF/Mvc/Dispatcher.php(158): XF::triggerRunOnce(true)
#13 src/XF/Mvc/Dispatcher.php(57): XF\Mvc\Dispatcher->dispatchLoop(Object(XF\Mvc\RouteMatch))
#14 src/XF/App.php(2351): XF\Mvc\Dispatcher->run()
#15 src/XF.php(517): XF\App->run()
#16 index.php(20): XF::runApp('XF\\Pub\\App')
#17 {main}

Request state

array(4) {
  ["url"] => string(145) "/account/alerts-popup?_xfRequestUri=%2F&_xfWithData=1&_xfToken=1d41%2C300bd332esa7917aae7f654b&_xfResponseType=json&_=164601fasd66"
  ["referrer"] => string(34) "https://www.domain.com/"
  ["_GET"] => array(5) {
    ["_xfRequestUri"] => string(1) "/"
    ["_xfWithData"] => string(1) "1"
    ["_xfToken"] => string(43) "164601,300bd332e5fe6a38"
    ["_xfResponseType"] => string(4) "json"
    ["_"] => string(13) "1646013948966"
  }
  ["_POST"] => array(0) {
  }
}
 

Painbaker

Well-known member
Seeing quite a few of these errors in the ACP after enabling CloudFlare. I updated to the latest DB, but it had no affect. Any ideas?

It looks like one of the addresses is being passed from a proxy.
Make sure your server is properly configured to restore visitor IP address from CloudFlare.


I have no experience with it, but the page says to add this lines to your config.php:

PHP:
if (isset($_SERVER['HTTP_CF_CONNECTING_IP'])) {
    $_SERVER['REMOTE_ADDR'] = $_SERVER['HTTP_CF_CONNECTING_IP'];
}
 

Joe Link

Well-known member
@Ozzy47 @Painbaker

Couple things :)

1) Is there a way to disable notifications for specific members? When sending a password reset, I see this in the changelog, but I can't seem to find the option anywhere in the UI.

1654802562995.png

2) In ACP > Logs > Country login log, clicking the numbers to view additional pages takes you to the front page of the ACP (/admin.php?&page=2).

1654802744339.png
 

Painbaker

Well-known member
1) Is there a way to disable notifications for specific members? When sending a password reset, I see this in the changelog, but I can't seem to find the option anywhere in the UI.


It should be located here:

1654853482222.png


If you don't have it, there might be a template modification conflict.
Can you send me a saved page with "user_edit" template contents with all modifications applied?

To do this, you need to enable "Development" mode, then navigate to:
Appearance > Styles > Master style templates > Admin > user_edit > View {count} template modifications

Then save this page with the right mouse button.

I'll make the regex better to capture possible changes.
 

Ozzy47

Well-known member
Ozzy47 updated [OzzModz] Login By Country Log with a new update entry:

[OzzModz] Login By Country Log for XenForo 2.1+ Update 2.1.0 Patch Level 3

2.1.0 Patch Level 1:

Added maxmind DB cron updater
Fix: mount own filesystem for local DB file (fixed incompatibility with external storage)
Fix: check only public app
Fix: hide alert preferences opt from not alerted users
Code refactor & cleanup

2.1.0 Patch Level 2:

Fixed ACP log pagination
Fixed regular expression for template modification to capture possible interference's by other add-ons

2.1.0 Patch Level 3

Fixed template modification conflict with DragonByte...

Read the rest of this update entry...
 

Joe Link

Well-known member
Just tried to upgrade and got this error :(

Code:
Server error log

    TypeError: Argument 2 passed to OzzModz\CountryLogin\Service\Logger::__construct() must be an instance of XF\Entity\User, string given, called in /home/domain/public/src/XF/Container.php on line 276 src/addons/OzzModz/CountryLogin/Service/Logger.php:35

    Generated by: Admin Jun 12, 2022 at 9:28 AM

Stack trace

#0 src/XF/Container.php(276): OzzModz\CountryLogin\Service\Logger->__construct(Object(XF\Admin\App), '67.160.185.224')
#1 src/XF/App.php(1709): XF\Container->createObject('OzzModz\\Country...', Array)
#2 src/XF/Container.php(234): XF\App->XF\{closure}('OzzModz\\Country...', Array, Object(XF\Container))
#3 src/XF/App.php(3022): XF\Container->create('service', 'OzzModz\\Country...', Array)
#4 src/addons/OzzModz/CountryLogin/Listener.php(33): XF\App->service('OzzModz\\Country...', '67.160.185.224')
#5 src/XF.php(377): OzzModz\CountryLogin\Listener::OzzModz\CountryLogin\{closure}()
#6 src/XF/Job/Manager.php(290): XF::triggerRunOnce()
#7 src/XF/Job/Manager.php(202): XF\Job\Manager->runJobInternal(Array, 8)
#8 src/XF/Job/Manager.php(118): XF\Job\Manager->runJobEntry(Array, 8)
#9 src/XF/Admin/Controller/Tools.php(122): XF\Job\Manager->runByIds(Array, 8)
#10 src/XF/Mvc/Dispatcher.php(352): XF\Admin\Controller\Tools->actionRunJob(Object(XF\Mvc\ParameterBag))
#11 src/XF/Mvc/Dispatcher.php(259): XF\Mvc\Dispatcher->dispatchClass('XF:Tools', 'RunJob', Object(XF\Mvc\RouteMatch), Object(X0815\ChkTables\XF\Admin\Controller\Tools), NULL)
#12 src/XF/Mvc/Dispatcher.php(115): XF\Mvc\Dispatcher->dispatchFromMatch(Object(XF\Mvc\RouteMatch), Object(X0815\ChkTables\XF\Admin\Controller\Tools), NULL)
#13 src/XF/Mvc/Dispatcher.php(57): XF\Mvc\Dispatcher->dispatchLoop(Object(XF\Mvc\RouteMatch))
#14 src/XF/App.php(2352): XF\Mvc\Dispatcher->run()
#15 src/XF.php(524): XF\App->run()
#16 admin.php(13): XF::runApp('XF\\Admin\\App')
#17 {main}

Request state

array(4) {
  ["url"] => string(29) "/admin.php?tools/run-job"
  ["referrer"] => string(57) "https://domain/admin.php?tools/run-job"
  ["_GET"] => array(1) {
    ["tools/run-job"] => string(0) ""
  }
  ["_POST"] => array(3) {
    ["_xfRedirect"] => string(94) "https://domain.com/admin.php?add-ons/install-from-archive-complete&batch_id=380"
    ["_xfToken"] => string(8) "********"
    ["only_ids"] => string(5) "44893"
  }
}
 

Painbaker

Well-known member
@Joe Link, it looks like the Listener.php file was left from the old version :unsure:

Make sure all add-on files have been successfully replaced (or reupload files manually through FTP)
 
Top