I’m implementing Event Listener SPI to trigger some API calls during the REGISTER
event. Internationalization is enabled but when the event is fired the locale
attribute of the user is null
. It’s filled after the event listener is fired probably. During the LOGIN
event, the user attribute is not null
anymore.
Sample code:
@Override
public void onEvent(Event event) {
UserModel user = session.users().getUserById(session.getContext().getRealm(), event.getUserId());
String locale = user.getFirstAttribute("locale"); // locale is null
...
Is there any other way to get the locale
during the initial registration phase? I checked out the event
object but couldn’t find anything helpful in it.