Showing results for 
Search instead for 
Did you mean: 

Creating a Log In form on homepage

Creating a Log In form on homepage



I am trying to create a log in form in the hero section of the header on my Magento website.


I have managed to display the form, however when the user clicks "Login", it redirects them to the login page where they will have to re-enter their username and password, rather than actually logging them in to the store.


The HTML I entered in the "Content" section of the page in CMS > Pages is:

<div class="block block-login"><form action="" method="post">
<div class="block-content"><input id="mini-login" class="input-text" spellcheck="false" type="email" placeholder="Email:" name="login[username]" /> <input class="input-text" type="password" placeholder="Password:" name="login[password] id=" /> <input type="hidden" value="ju8X3z6YM43Vd01k" name="form_key" />
<div class="actions"><button class="button" type="submit"> <span> <span>Login</span> </span> </button></div>

Please advise me what is missing?


Re: Creating a Log In form on homepage

Hello @jordan_cardwell


you can not put form key same for all users


<?php echo $this->getBlockHtml('formkey')?>

you need to add form key using above url


Hope it will help you.



Problem solved? Click Kudos & Accept as Solution!
Sunil Patel
Magento 2 Certified Professional Developer & Frontend Developer