6

Out of the box Magento 2 adds <div class="modal-content" data-role="content"> div at the end of the code. I am not sure what it is supposed to do. But it contains a login form with password input. Chrome/firefox are now signalling any pages that ask for sensitive information that are not served over SSL. So every page of Magento 2 will show as "not secure" in Chrome where the SSL info is shown. It is because of this line of code:

<input name="login[password]" autocomplete="off" class="input-text" id="pass" title="Password" data-validate="{required:true, 'validate-password':true}" aria-required="true" type="text">

Changing type to text removed the error. But I do not know which file is generating this. And if other login forms use the same code, their password entry will be visible instead of ****

Maybe it is coming from vendor\magento\module-customer\view\frontend\web\template\authentication-popup.html but whenever I change the code there it does not affect my magento pages. (flush, reindex, compile etc)

I do not want to run the entire frontend in SSL & do not want the "not secure" error - which is misunderstood by many.

Is there any way to fix this? Where is the code to edit the output of the problematic password input?

This is the chrome inspector HTML output for a fresh 2.1.5 install on blank theme after static:deploy

enter image description here

  • Hi, just to understand it right: This modal-content is added to every Magento 2 page in your frontend? Which version of Magento 2 are you using? Did you do any customizations with ui Components? – Anna Völkl Mar 9 '17 at 6:36
  • have a look at magento2-demo.nexcess.net on chrome. Vanilla Luma. Has not secure in SSL position in chrome and the modal-content div. It is at the bottom of the page in my code inspector. It is not in source but some type of JS I think – Jon Mar 9 '17 at 8:24
  • Hi Jon, I am sorry but I can't reproduce this. I do not see that code on the bottom of the page or in the source. Searching for "modal" in the source code of the home page does not bring a result. Can you please update your question with a screenshot maybe? – Anna Völkl Mar 9 '17 at 8:38
  • I added pics. As I said it is not in the source code, only compiled code – Jon Mar 9 '17 at 12:27
  • I just did a new install of 2.1.5. No modals wrapper. After running setup:static-content:deploy there it is. Hence not in source code but being generated by some sort of Javascript. So I am having issues finding the code to fix it. Does your install really not have it? – Jon Mar 9 '17 at 14:51
4
+50

It does come from vendor\magento\module-customer\view\frontend\web\template\authentication-popup.html. Since this is a knockout.js template file, you will have to delete your static content and then re-deploy (if you are in production mode) in order for changes to come through (clearing browser cache is also necessary sometimes). Instead of editing the file directly, you should copy it to your theme in here: app/design/frontend/{Vendor}/{Theme}/Magento_Customer/web/template/authentication-popup.html in order to override it from your theme.

To delete the static content, run rm -rf pub/static/* var/view_preprocessed/* from magento root directory. In production mode you then run the static content deployment command.

As far as I can tell, this modal is used if 'guest checkout' is disabled and a customer who is not logged in clicks on 'Proceed to Checkout' button in minicart or cart page. If guest checkout is enabled for your store, then you can remove it completely by disabling the layout block. To do this, create the file app/design/frontend/{Vendor}/{Theme}/Magento_Customer/layout/default.xml with this contents:

<?xml version="1.0"?>

<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <body>
        <referenceBlock name="authentication-popup" remove="true"/>
    </body>
</page>

You must flush the cache after adding this file.

2

The thing is named authentication-popup in the layout xml. You can remove it with

<referenceBlock name="authentication-popup" remove="true"/>

in ../page_layout/1column.xml for example.

But I'm not really sure what it is used for either and if it is safe to remove it just like that.

This seems to be the file it is coming from:

../app/code/Magento/Customer/view/frontend/web/js/model/authentication-popup.js

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.