feat(frontend): open Keycloak pages in the app's language
Login and sign-up redirects pass the current language as ui_locales.
This commit is contained in:
parent
d52960fa0a
commit
6e6d37650d
@ -1,3 +1,4 @@
|
|||||||
|
import i18n from "i18next";
|
||||||
import { User, UserManager, WebStorageStateStore } from "oidc-client-ts";
|
import { User, UserManager, WebStorageStateStore } from "oidc-client-ts";
|
||||||
|
|
||||||
const CALLBACK_PATH = "/auth/callback";
|
const CALLBACK_PATH = "/auth/callback";
|
||||||
@ -68,11 +69,11 @@ export class AuthService {
|
|||||||
|
|
||||||
// prompt=login shows the login form even though the guest already has a session.
|
// prompt=login shows the login form even though the guest already has a session.
|
||||||
public login(returnTo = currentPath()): Promise<void> {
|
public login(returnTo = currentPath()): Promise<void> {
|
||||||
return this.userManager.signinRedirect({ prompt: "login", state: { returnTo } });
|
return this.userManager.signinRedirect({ prompt: "login", ui_locales: i18n.language, state: { returnTo } });
|
||||||
}
|
}
|
||||||
|
|
||||||
public signUp(returnTo = currentPath()): Promise<void> {
|
public signUp(returnTo = currentPath()): Promise<void> {
|
||||||
return this.userManager.signinRedirect({ prompt: "create", state: { returnTo } });
|
return this.userManager.signinRedirect({ prompt: "create", ui_locales: i18n.language, state: { returnTo } });
|
||||||
}
|
}
|
||||||
|
|
||||||
public logout(): Promise<void> {
|
public logout(): Promise<void> {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user