Experiencing a 401 Unauthorized Error During Update?

If you're seeing a 401 Unauthorized error when trying to update your Joomla extension, it's likely due to our new two-factor authentication (2FA) security measure for your Download ID.
To resolve this, check your email (Spam folder?) for a message to approve your server or device, or read our detailed blog post here( onlinecommunityhub.nl/best-practice/new-...-extension-downloads) to understand the steps involved. This will guide you through approving your server for future updates.

Implemented There is no "com_ochsubscriptions.site.script" asset of a "script" type in the r

More
3 months 3 weeks ago #3041 by joomill
Hi Ruud,

I hope you're doing fine.
I recieved this message today: "I would like to change my password on your site but under my account I go to Edit Profile and it has an error: There is no "com_ochsubscriptions.site.script" asset of a "script" type in the registry." When i checked it, there was an error indeed. 

This is fixed when i uncomment these lines at: /administrator/components/com_ochsubscriptions/models/fields/radio.php
    protected function getInput()
    {
        OchsubscriptionsHelper::setDebugLevel();
        /** @var Joomla\CMS\WebAsset\WebAssetManager $wa */
        //$wa = Factory::getApplication()->getDocument()->getWebAssetManager();
        //$wa->useScript('com_ochsubscriptions.site.script');
        //if (Config::get('load_stylesheet')) {
        //$wa->useStyle('com_ochsubscriptions.element.ochsubscriptions-toggle');
        //}
        return parent::getInput();
    }

Maybe it will give me other errors but i didn't notice it yet.
There are no overrides and the error also occurs when i change the template to cassiopeia
Can you have a look at this?
Thanks in advance.
Jeroen
 
The topic has been locked.
More
3 months 3 weeks ago #3042 by Ruud van Lent
Good Morning Jeroen,
Holidays are over, well deserved rest as well :)

 This is fixed when i uncomment these lines at: /administrator/components/com_ochsubscriptions/models/fields/radio.php
 

You say that in de radio.php field you UNcomment the lines and that it then worked, but when looking at the original file (from the installation package), then you see that these lines are NOT commented.
so a little bit confused here: did you mean you commented the lines so they will not execute?

Do you have for me an url to the site you are experiencing this issue (front-end)?
The topic has been locked.
More
3 months 3 weeks ago #3043 by joomill
You're right. (It was late) I commented these lines.
I have also another site with ochsub and there everything works fine, so it should be something specific in my site/config.

I will create an account for you, so you can see.
(it's only on the user profile page)
The topic has been locked.
More
3 months 3 weeks ago #3044 by Ruud van Lent
Hi Jeroen,
can you add the following line in the ./administrator/components/com_ochsubscriptions/models/fields/radio.php
Code:
        $wa->getRegistry()->addExtensionRegistryFile('com_ochsubscriptions');

the code should then look like this:
Code:
    /**      * Method to get the field input markup for calendar dates.      *      * @return  string  The field input markup.      */     protected function getInput()     {         OchsubscriptionsHelper::setDebugLevel();         /** @var Joomla\CMS\WebAsset\WebAssetManager $wa */         $wa = Factory::getApplication()->getDocument()->getWebAssetManager();         $wa->getRegistry()->addExtensionRegistryFile('com_ochsubscriptions');         $wa->useScript('com_ochsubscriptions.site.script');         if (Config::get('load_stylesheet')) {             $wa->useStyle('com_ochsubscriptions.element.ochsubscriptions-toggle');         }         return parent::getInput();     }
The topic has been locked.
More
3 months 3 weeks ago #3045 by joomill
This works as expected, Thank you!
The topic has been locked.
More
3 months 3 weeks ago #3046 by Ruud van Lent
Top,
so the 'issue' is that on this particular page com_ochsubscriptions is not 'booted' and as such the assets registry file is not loaded.
The radio.php (toggle) is loaded on the form via the ochsubscriptions system plugin, the form is displayed by com_users.

The fix we have now is to force load the com_ochsubscriptions asset registry. This will then ensure that the registry is available even in cases when not all components (ochsubscription in this case) are booted.

On the other sites where it works correct, ochsubscriptions is correctly booted even when on the com_users page. Why this is not the case on this site is not clear and would need a deepdive into the site.

I will add this as a fix in the new version.

Thanks for reporting!
The topic has been locked.