Skip to content

Commit

Permalink
MAGETWO-50247: [GitHub] Frontend Login Post Page exception
Browse files Browse the repository at this point in the history
  • Loading branch information
Joan He committed Mar 9, 2016
1 parent 5481fac commit b72339e
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion app/code/Magento/Captcha/Observer/CheckUserLoginObserver.php
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,9 @@ public function execute(\Magento\Framework\Event\Observer $observer)
$captchaModel = $this->_helper->getCaptcha($formId);
$controller = $observer->getControllerAction();
$loginParams = $controller->getRequest()->getPost('login');
$login = array_key_exists('username', $loginParams) ? $loginParams['username'] : null;
$login = (is_array($loginParams) && array_key_exists('username', $loginParams))
? $loginParams['username']
: null;

This comment has been minimized.

Copy link
@adragus-inviqa

adragus-inviqa Jun 10, 2016

Contributor

Could've been a more prettier $controller->getRequest()->getPost('login', []);

if ($captchaModel->isRequired($login)) {
$word = $this->captchaStringResolver->resolve($controller->getRequest(), $formId);
if (!$captchaModel->isCorrect($word)) {
Expand Down

1 comment on commit b72339e

@BrM123
Copy link

@BrM123 BrM123 commented on b72339e May 18, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My file is in vendor/magento/module-captcha/Observer/CheckUserLoginObserver.php
I fixed file and don't get any system error. If i try login in user front end get error "A login and a password are required." I disable magento_captcha module and solves the problem without editing code.

Please sign in to comment.