0

$message = '';

$authenticationUtils = $this->get('security.authentication_utils');
$error = $authenticationUtils->getLastAuthenticationError();
if (!empty($error)) {
    $message = $error->getMessage();
    if ($message == 'Bad credentials.') {
        $message = '您的账号和密码不匹配!' ;
    }
}

return $this->render('account/login.html.twig', array(
    'message' => $message,
));

撰写答案