Magento 2.3 MGS front-end block not working correctly on live website

I am facing a strange issue in Magento 2.3.

I am using Unero template with MGS front-end builder which contains a block to show products by attribute.

It was working fine until recently I noticed it ignores the attribute I define and shows only grouped products regardless of the selected attribute.

The strange part is that the same block is working correctly on local development machine with an exact copy of the live website and DB.

Of course I’ve already tried clearing the cache multiple times and tried even disabling cache but it didn’t help.

What am I missing here?

React: Verificar usuário autenticado pelo front-end!

Como eu poderia verificar se um token é verdadeiro? Tenho uma api com laravel passport e o front com react, o usuário coloca email e senha, a api verifica e se tiver usuário no banco ele gera um token e armazena no local storage, tenho uma private route, e pra isso precisaria sabrr se o usuario esta autenticado, a dúvida é, como verifico se o token é verdadeiro? Anteriormente fiz uma lógica, mas n funcionou, pois se alguém abrisse o console e colocasse um valor qualquer no token, ele retornava true e a pessoa estava livre pra acessar o sistema.

Como poderia verificar o token com base nesta função abaixo?

const checkAuth = {   isAuthenticated: false,   authenticate(cb) {     this.isAuthenticated = true     setTimeout(cb, 100)   },   signout(cb) {     this.isAuthenticated = false     setTimeout(cb, 100)   } } 

Magento 2 frontend route only allow POST method

I create a frontend route like this:

<?xml version="1.0"?>  <config xmlns:xsi="" xsi:noNamespaceSchemaLocation="urn:magento:framework:App/etc/routes.xsd">     <router id="standard">         <route id="spin" frontName="spin">             <module name="Neverending_Story" />         </route>     </router> </config> 

How can i allow only POST method request that can access this route ??

Problema con cors en aplicación laravel con frontend Angular

Tengo un problema claro, tengo una api restful creada en laravel 5.2 y al hacer las peticiones con postman todo va perfectamente.

Sin embargo con mi aplicación angular no puedo acceder al servidor porque no tengo habilitado CORS:

Access to XMLHttpRequest at 'http://localhost:8000/api/login' from origin 'http://localhost' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. 

He probado a instalar la librería de cors y me da fallo y a implementarlo de forma manual y nada. ¿es posible que haya algún error en la aplicación Angular?

Securing a microservice that will be accessible from frontend

I need an advice on securing interaction between an application App and a microservice RecordApp.

App is the main application, where all users are registered and do some activity. RecordApp is a utility application where App users can store records that publicly visible in the App (like sub-twitter). RecordApp knows nothing about users, but each record (“tweet”) needs to have an author. I need to provide ability to use the RecordApp from the frontend and don’t use the App like a proxy. I have some options to do this:

The first is: User passes authentication on the App server and receives JWT token (that was signed using App public key) that tells that the user has name “User1” and can create public records. Then user sends this to RecordApp, it validates it (using RecordApp secret key) and sees that this user can create a record and then creates it. But if some hacker steals the User cookie, then the hacker can post malicious records by the name of “User1”. I could solve this by setting httpOnly flag for the cookie, but App and RecordApp have different domains, so that wouldn’t work.
What do I do to secure such microservice?

The second option is as user passes authentication on the App server, send to the user a public_key that will be used to sign jwt with the record contents. If the hacker will be able to steal it from the-middle, then they just can post this message unchanged. But what do I do to protect the public key then?

Thanks in advance!

Magento2: Knockout JS page in frontend give “404”

I have follow this tutorial link


Magenest/KnockoutJs/etc/frontend/routes.xml :

<?xml version="1.0"?> <config xmlns:xsi="" xsi:noNamespaceSchemaLocation="urn:magento:framework:App/etc/routes.xsd">    <router id="standard">        <route id="knockout" frontName="knockout">            <module name="Magenest_KnockoutJs" />        </route>    </router> </config> 

Magenest/KnockoutJs/view/frontend/layout/knockout_test_index.xml :

<?xml version="1.0"?> <page xmlns:xsi="" layout="1column"      xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">    <head>        <title>Knockout Js Testing Page</title>    </head>    <body>        <referenceBlock name="content">            <block class="Magenest\KnockoutJs\Block\Test" name="knockoutjs_test_block" template="test.phtml">                <arguments>                    <argument name="jsLayout" xsi:type="array">                        <item name="components" xsi:type="array">                            <item name="test" xsi:type="array">                                <item name="component" xsi:type="string">Magenest_KnockoutJs/js/view/test</item>                                <item name="displayArea" xsi:type="string">test</item>                            </item>                        </item>                    </argument>                </arguments>            </block>        </referenceBlock>    </body> </page> 

Magenest/KnockoutJs/Block/Test.php :

<?php namespace Magenest\KnockoutJs\Block;  use Magento\Framework\View\Element\Template;  class Test extends Template {    /**     * @var array|\Magento\Checkout\Block\Checkout\LayoutProcessorInterface[]     */    protected $  layoutProcessors;     public function __construct(        Template\Context $  context,        array $  layoutProcessors = [],        array $  data = []    ) {        parent::__construct($  context, $  data);        $  this->jsLayout = isset($  data['jsLayout']) && is_array($  data['jsLayout']) ? $  data['jsLayout'] : [];        $  this->layoutProcessors = $  layoutProcessors;    }     public function getJsLayout()    {        foreach ($  this->layoutProcessors as $  processor) {            $  this->jsLayout = $  processor->process($  this->jsLayout);        }        return \Zend_Json::encode($  this->jsLayout);    }  } 

Magenest/KnockoutJs/Controller/Test/Index.php :

<?php namespace Magenest\KnockoutJs\Controller\Test;  class Index extends \Magento\Framework\App\Action\Action {     protected $  resultPageFactory;     public function __construct(        \Magento\Framework\App\Action\Context $  context,        \Magento\Framework\View\Result\PageFactory $  resultPageFactory    )    {        $  this->resultPageFactory = $  resultPageFactory;        parent::__construct($  context);    }     public function execute()    {        $  resultPage = $  this->resultPageFactory->create();        return $  resultPage;     } } 

Magenest/KnockoutJs/view/frontend/templates/test.phtml :

<div id="test-div" data-bind="scope:'test'">    <!-- ko template: getTemplate() --><!-- /ko -->    <script type="text/x-magento-init">        {            "#test-div": {                "Magento_Ui/js/core/app": <?php /* @escapeNotVerified */ echo $  block->getJsLayout();?>            }        }    </script>     <script>        require([            'mage/url',            'Magento_Ui/js/block-loader'        ], function(url, blockLoader) {            blockLoader("<?php /* @escapeNotVerified */ echo $  block->getViewFileUrl('images/loader-1.gif'); ?>");            return url.setBaseUrl('<?php /* @escapeNotVerified */ echo $  block->getBaseUrl();?>');        })    </script> </div> 

Magenest/KnockoutJs/view/frontend/web/js/view/test.js :

define([    'ko',    'uiComponent',    'mage/url',    'mage/storage', ], function (ko, Component, urlBuilder,storage) {    'use strict';    var id=1;     return Component.extend({         defaults: {            template: 'Magenest_KnockoutJs/test',        },         productList: ko.observableArray([]),         getProduct: function () {            var self = this;            var serviceUrl ='knockout/test/product?id='+id);            id ++;            return                serviceUrl,                ''            ).done(                function (response) {                    self.productList.push(JSON.parse(response));                }            ).fail(                function (response) {                    alert(response);                }            );        },     }); }); 

Magenest/KnockoutJs/view/frontend/web/template/test.html :

<button data-bind=" click: getProduct">Get Next Product</button> <table>    <thead>    <tr>        <th>ID</th>        <th>Product Name</th>        <th>Product Price</th>        <th>Preview</th>    </tr>    </thead>    <tbody data-bind="foreach: productList">    <tr>        <td data-bind="text: entity_id"></td>        <td data-bind="text: name"></td>        <td data-bind="text: price"></td>        <td><img data-bind="attr: {src: src}" width="120" height="150" alt="Product Image"></td>    </tr>    </tbody> </table> 

Magenest\KnockoutJs\Controller\Test\Product.php :

<?php namespace Magenest\KnockoutJs\Controller\Test;  use Magento\Catalog\Model\ProductFactory; use Magento\Catalog\Helper\Image; use Magento\Store\Model\StoreManager;  class Product extends \Magento\Framework\App\Action\Action {    protected $  productFactory;    protected $  imageHelper;    protected $  listProduct;    protected $  _storeManager;     public function __construct(        \Magento\Framework\App\Action\Context $  context,        \Magento\Framework\Data\Form\FormKey $  formKey,        ProductFactory $  productFactory,        StoreManager $  storeManager,        Image $  imageHelper    )    {        $  this->productFactory = $  productFactory;        $  this->imageHelper = $  imageHelper;        $  this->_storeManager = $  storeManager;        parent::__construct($  context);    }     public function getCollection()    {        return $  this->productFactory->create()            ->getCollection()            ->addAttributeToSelect('*')            ->setPageSize(5)            ->setCurPage(1);    }     public function execute()    {        if ($  id = $  this->getRequest()->getParam('id')) {            $  product = $  this->productFactory->create()->load($  id);             $  productData = [                'entity_id' => $  product->getId(),                'name' => $  product->getName(),                'price' => '$  ' . $  product->getPrice(),                'src' => $  this->imageHelper->init($  product, 'product_base_image')->getUrl(),            ];             echo json_encode($  productData);            return;        }    } } 

Required Result : enter image description here

But Getting “404”

Complete Module Here