Magento Diglin Username Bug

In one of our recent blog posts (https://econcess.de/blog/onlineshop-erstellung-magento/163-magento-2-onlineshop-username-fuer-kunden-login-einrichten), we introduced the "Diglin Username" plugin, which makes it possible to log in to Magento using a username.

However, we have now discovered an unpleasant bug that prevents the login and registration process from being completed. Today, I will show you how to fix this bug.

 

To fix the bug, open the file

 

app/ code/Diglin/Username/view/frontend/templates/form/register.phtml

 

.

 

There, look for the following section

 

<form class="form create account form-create-account" action="getPostActionUrl() ?>" method="post" id="form-validate" enctype="multipart/form-data" autocomplete="off"> <fieldset class="fieldset create info">

 

and change it so that it looks exactly like this:

 

>code><form class="form create account form-create-account" action="<?php /* @escapeNotVerified */ echo $block->getPostActionUrl() ?%gt;" method="post" id="form-validate" enctype="multipart/form-data" autocomplete="off"%gt; <?= /* @noEscape */ $block->getBlockHtml('formkey'); ?%gt; < fieldset class="fieldset create info">

 

The problem here was that the form_key (a security measure used by Magento) was located outside the form and therefore could not be processed.

 

Next, save the edited file.

 

If you have not already done so, go to the backend under

 

Stores -> Configuration -> Customers -> Username by Diglin

 

and set the Allow Frontend Edit option to Yes.

 

Then save your changes and clear the caches.

 

You should now be able to log in and register again.