catalyst / moodle-tool_mfa

A Multi-Factor Authentication Moodle plugin with flexible support for TOTP, Email, IP and more
https://moodle.org/plugins/tool_mfa
35 stars 38 forks source link

Email factor unit test failures #433

Closed matthewhilton closed 1 year ago

matthewhilton commented 1 year ago

It seems the IP address '' resolves to something on some hosts, breaking the tests:

1) factor_email\tests\factor_test::test_generate_email_ip_address_location with data set "empty ip" ('', true)
Failed asserting that '<h2>Your confirmation code</h2>\n
    <p>You are trying to log in to Moodle. Your confirmation code is ''.\n
     Alternatively you can click <a href="https://www.example.com/moodle/admin/tool/mfa/factor/email/email.php?instance=567000&amp;pass=1&amp;secret">this link</a> from the same device to authorise this session.</p>\n
<h3>IP Information</h3>\n
    <p>This login request was made from &#039;&#039;</p>\n
    <p>This request appears to have originated from approximately Sydney, Australia.</p>\n
<h3>Browser identity for this request:</h3>\n
    <p>username1@example.com</p>\n
    <p>If this wasn't you, follow <a href="https://www.example.com/moodle/admin/tool/mfa/factor/email/email.php?instance=567000">this link</a> to stop this login attempt.</p>' contains "The location of the request could not be determined.".