protected function onAuthenticationFailure(AuthenticationRequiredException $exception = null)
{
if ($this->view instanceof JsonView) {
$this->view->assign('value', array('success' => false));
} else {
$this->addFlashMessage('The entered username or password was wrong', 'Wrong credentials', Message::SEVERITY_ERROR, array(), $exception === null ? 1347016771 : $exception->getCode());
}
}