LoggedInUser widget does not fully work after migration from 3 to 4

2
After migrating from 3 to 4 the LoggedInUser widget shows the anonymous user name when accessing as anonymous user. It used to show the defaultcaption. Seems like the following code of the widget does not work anymore: if (mx.session.isGuest() == true || mx.session.isGuest() == "true") { Are there any plans to update the widget to the mx 4 API? I guess I am looking at ManSystems as the makers of the widget here ;-)
asked
2 answers
1

In version 4 it is mendix.sys.Session

answered
1

Hi Frans,

We currently working with Mendix 4.2.2 and there the widgets works fine. But I checked the widget in Mendix 4.3.1 and you're right, you get an error.

I seems that the method mx.session.isGuest() now returns null if it is an anonymous user. If you are logged in, you get the correct 'false' answer. Seems to be an mendix bug, or I am using the wrong function, although i could not find any other isGuest() function.

You can fix the widget by replacing the code with:

        var guest = mx.session.isGuest();

    if (guest == null || guest == true || guest == "true")

I hoped this helped.

answered