[keycloak-user] Login UI locale reverting to browser's on wrong user/password

Carlos Villegas cav at uniscope.jp
Wed Mar 7 23:05:57 EST 2018


Yes, I've tested it with 3.4.3.Final and same results. To make sure I tested with the default login theme, I had a custom login theme and had set "display: none" to the locale selection tag. However, I see that this is not submitted with the form, instead, the locale pulldown reloads the login form sending a 'kc_locale' parameter in the login actions URL. An then after that if there's an error it works OK. 
However, on first getting to the login form with a ui_locales parameter sent from the client, things don't work. I was thinking that if I add an hidden input field to the form, setting the kc_locale parameter with the current locale, maybe that'll do it. Can somebody confirm this?

If that works, is the current locale available in some freemarker variable? I'm not familiar with freemarker, or how is setup in Keycloak, or can I get access to the URL parameters? I can also try some javascript to extract it from the locale menu, but it's simpler if it's available somewhere from the template. I can then send it with the form as kc_locale param, to make sure the locale stays where it is. 

Carlos


> On March 6, 2018 at 1:26 PM Marek Posolda <mposolda at redhat.com> wrote:
> 
> 
> On 06/03/18 05:19, Carlos Villegas wrote:
> > Hi,
> >
> > I'm using the docker image version 3.4.0.Final. I've setup a realm and enabled internationalization, set default locale to English.
> >
> > I'm using the Javascript adapter and I set the locale I want in the login options. I have a custom theme where I've hidden Keycloak's login screen Locale selection menu. I'm sending the locale using the login options of the login call of the Javascript adapter.
> >
> > The keycloak login screen comes up in the correct locale I requested in the login options. However, if I put the wrong password and submit, the next error screen comes in what it seems is the web browser's default language.
> >
> > For example, in a English Windows 10 installation using Chrome which is in English, I request Japanese locale. The Keycloak login screen comes correctly in Japanese, but if I enter the wrong password, next error screen requesting to reenter login info is in English, all labels and error messages in English. It seems Keycloak's forgetting my locale option and using the browser's.
> >
> > Using the same server, from a Japanese Windows 10 machine, using Chrome in Japanese, the user requests English locale, it gets correctly the English login screen. Enters the wrong password, and the next error screen is in Japanese!. Note that this is not even the default locale I've set up in Keycloak which is English.
> >
> > I see in the login URL sent from the client that the ui_locales parameter is properly set to the value I want, as I said the first login screen is in the correct locale I've requested. The problem is if there's any error, the screens with error messages don't have the correct locale.
> >
> > Any idea of what can be happening, and if by any change this has been corrected the latest version of Keycloak. I'm haven't had the chance to test the latest version yet.
> Yes, I would try to test with latest version. If it doesn't help, 
> probably create JIRA with description of your usecase.
> 
> Marek
> >
> > Cheers,
> >
> > Carlos
> > _______________________________________________
> > keycloak-user mailing list
> > keycloak-user at lists.jboss.org
> > https://lists.jboss.org/mailman/listinfo/keycloak-user
> 
>


More information about the keycloak-user mailing list