Topic-icon Error for users with 2 way authentication enabled in SC Login module 8.4.6

Support Specialist
Ok. Definitely keep us posted. The new way we implemented the 2FA check uses Joomla's built-in com_ajax component, which has Joomla's own built-in security checks. There shouldn't be anything blocking calls to com_ajax on the server or else other extensions would likely fail as well.

Just some background on the change. When you narrow down the cause though, let us know and we'll gladly help investigate further!

Thanks,
Alex
The topic has been locked.
Active Subscriptions:

None
2 years 11 months ago - 2 years 11 months ago #67278 by markboos
When i log in with my credentials, and that account has TFA, the TFA message to fill in my two way auth code does not appear. I installed the new mod_sclogin (8.4.7) and it gives this error:

"<b>Deprecated</b>: Non-static method ModScloginHelper::otpcheckAjax() should not be called statically in <b>/srv/data/var/www/vhosts/mywebsite.com/httpdocs/components/com_ajax/ajax.php</b> on line <b>102</b><br />"

This error message prevented the html for the TFA to be displayed. I switched off error output in Joomla! and there... it works :) So if the deprecated error in ajax.php can be solved i can switch on error reporting again.
Last edit: 2 years 11 months ago by markboos.
The topic has been locked.
Support Specialist
This looks to be an issue with the update to the code we implemented for One-Time Password checks in the SCLogin module.

If you could make a small change to the following file, it should remove that Deprecated message and make things work. To do so, please edit:
/modules/mod_sclogin/helper.php
Around line 174, you'll see:
public function otpcheckAjax()
Update that to as below adding the word 'static':
public static function otpcheckAjax()

That should fix you up. Please let us know you're results though and we'll make sure this is in the next release!

Thanks,
Alex
The topic has been locked.
Support Specialist
Ok.. we tested the above and the answer requires a little more code...

At the same line 174, you should see the following:
public static function otpcheckAjax()
    {
        $response = new stdClass();
That will need to be updated to:
[code]    public static function otpcheckAjax()
    {
        $modId = JFactory::getApplication()->input->get('mod_id');
        $mod = JModuleHelper::getModuleById($modId);
        $params = new Registry();
        $params->loadString($mod->params);
        $helper = new ModScloginHelper($params);

        $response = new stdClass();
So, add 'static' to the first line and then add 5 new lines after that before the $response = new stdClass(); line.

Hopefully, that's clear, but again, we'd love your feedback. Obviously, we're doing some testing with this and will let you know if we run into anything else, but this seems to fix all the issues we encountered.

Thanks!
Alex
The topic has been locked.
Active Subscriptions:

None
I saw that you refer to line 174 in helper.php, but in version 8.4.7 the function otpcheckAjax is at line 135.

I added the code anyway (line 135) but now i get this error:
0 - Class 'Registry' not found
So I ll stick to the original 8.7.4 and switch off error logging :)
The topic has been locked.
Support Specialist
If you add the following to the top of the file with the other use statements, it should fix up that error:
use Joomla\Registry\Registry;
The topic has been locked.