Skip to content

Commit

Permalink
The Login controller now is processed as a POST
Browse files Browse the repository at this point in the history
  • Loading branch information
pitbulk committed Jun 17, 2020
1 parent ce5684e commit 872dca1
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions Custom/Login/Block/Login/Elements.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,26 +9,31 @@

use Magento\Framework\View\Element\AbstractBlock;
use Magento\Framework\View\Element\Template\Context;
use Magento\Framework\Data\Form\FormKey;
use Magento\Store\Model\StoreManagerInterface;

class Elements extends AbstractBlock
{
private $storeManager;
private $formkey;

public function __construct(
Context $context,
StoreManagerInterface $storeManager,
array $data = []
array $data = [],
FormKey $formkey
) {

$this->storeManager = $storeManager;
$this->formkey = $formkey;
parent::__construct($context, $data);
}

public function _toHtml()
{
$html = '';

$formkey = $this->formkey->getFormKey();
$loginUrl = $this->storeManager
->getStore()
->getUrl("mysso/custom/login");
Expand All @@ -38,8 +43,10 @@ public function _toHtml()
<strong role="heading">Custom Login</strong>
</div>
<div class="block-content">
<a class="action login primary"
href="'.$loginUrl.'">Custom login</a>
<form id="custom_login" action="'.$loginUrl.'" method="post" novalidate="novalidate">
<input name="form_key" type="hidden" value="'.$formkey.'">
<button type="submit" class="action login primary" name="Custom Login" id="customsend"><span>Custom Login</span></button>
</form>
</div>';
return $html;
}
Expand Down

0 comments on commit 872dca1

Please sign in to comment.