1

We would like to add a checkbox to the frontend login in order to redirect that login to the admin login in case the checkbox is checked. The redirection would login them in the backend login and grant them acces to the backend.

But mainly, and to start off we would like to get that checkbox online.

It should appear on the green rectangle:

enter image description here

I have overwritten: \vendor\magento\module-customer\view\frontend\templates\form\login.phtml with \app\design\frontend\<custom-vendorname>\<custom-themename>\Magento_Customer\templates\form\login.phtml.

And the code overwritten:

<div class="block block-customer-login">
    <div class="block-title">
        <strong id="block-customer-login-heading" role="heading" aria-level="2"><?php echo $block->escapeHtml(__('Registered Customers')) ?></strong>
    </div>
    <div class="block-content" aria-labelledby="block-customer-login-heading">
        <form class="form form-login"
              action="<?php echo $block->escapeUrl($block->getPostActionUrl()) ?>"
              method="post"
              id="login-form"
              data-mage-init='{"validation":{}}'>
            <?php echo $block->getBlockHtml('formkey'); ?>
            <fieldset class="fieldset login" data-hasrequired="<?php echo $this->helper(\Magento\Framework\EscapeHelper::class)->escapeHtmlAttr(__('* Required Fields')) ?>">

                <div style="width: auto; margin: 0;" class="field choice newsletter">
                    <input type="checkbox" data-validate="{required:true}" name="custom-terms" title="<?php /* @escapeNotVerified */ echo __('Dealer access') ?>" id="register-input-custom" class="checkbox">
                    <label for="custom-terms" class="label">
                <span>
                    <?php echo __('Mark this if you want to access as a dealer. ') ?><a href="<?php echo $this->getUrl('redirection');?>"></a>
                </span>
                    </label>
                </div>

            </fieldset>
        </form>
    </div>
</div>

I have run these commands:

   rm -rf pub/static/*;
   php bin/magento setup:upgrade;
   php bin/magento setup:static-content:deploy; 
   php bin/magento setup:static-content:deploy es_ES;
0

I had the code overwritten in another extension, so the code is right.

enter image description here

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.