Translate error message of login form

核能气质少年 提交于 2019-12-08 20:04:38

In file Sonata/UserBundle/Resources/views/Admin/Security/login.html.twig You have:

<div class="alert-message error">{{ error|trans({}, 'SonataUserBundle') }}</div>

so You must change SonataUserBundle to whatever translation file You are using or add src/Your/Bundle/Resources/translations/SonataUserBundle.{locale}.yml

and inside translation file:

'Bad credentials': 'Your translation'
'The presented password is invalid.': 'Your translation'
'The presented password cannot be empty.': 'Your translation'

I hope it's clear enough ;]

In version 1.3 of FOSUserBundle "Bad Credentials" it's actually "Bad Credentials." (mind the last dot).

I don't think so. You have to catch the error and do what you need to do...For example display a message with flash session message and redirect to your forget password page.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!