Problem with anonymous UI screens and subsequent login

I’m running into some issues implementing an anonymous initial screen that has a link to login. I have a class called ExtAppLoginWindow (ext-loginwindow.xml) that implements the screen of my anonymous home page. It extends AbstractWindow and implements TopLevelWindow.

I have the actual login window in a screen called DoLogin (do-login.xml) which gets opened when you click on a login button:


public void onLoginMenuItemClick() {
        AppLoginWindow loginScreen = (AppLoginWindow) openWindow("do-login", WindowManager.OpenType.DIALOG);
    }

This causes a nullpointer exception because DoLogin is unable to find the settings in web-app.properties or app.properties which contain the availableLocales and when AppLoginWindow does a


Locale selectedLocale = localesSelect.getValue();
app.setLocale(selectedLocale);

You get the null pointer error. How do I get the other login window to find the available locales and potentially the default login user?

I’m experiencing some broader issue with app properties and message properties. It is properly reading loginWindow.welcomeLabel from gui\messages.properties but it’s not finding loginWindow.logoImage which is set to " img/app-icon-login.png".

It’s also not finding cuba.availableLocales, cuba.localeSelectVisible in app.properties and I added a cuba.web.loginDialogPoweredByLinkVisible = false and that’s not working either.

The issue is not the second login screen because I got rid of that and moved everything back to ExtAppLoginWindow.

Any help would be appreciated. Spent the whole day unsuccessfully trying to figure it. Without being able to login and go to the mainwindow, I cannot do most of the development.

Hi,

Unfortunately, we cannot reproduce the problem. Could you share a small project that illustrates this problem?

Finally figured it out. When you add a vbox to the layout of the login screen, it breaks something that causes the locale loading and the working of cuba.web.loginDialogPoweredByLinkVisible and loginWindow.caption to stop working.

The cuba-platform login page has a loginWrapper and a loginMainBox. I wanted to add a homePageWrapper next to loginWrapper or a homePageMainBox next to loginMainBox and then make one visible and the other not visible depending on the context.

Here is a simplified example of an ext-loginwindow.xml that causes the problem:


<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<window xmlns="http://schemas.haulmont.com/cuba/window.xsd"
        class="com.xxx.web.loginwindow.ExtAppLoginWindow"
        extends="/com/haulmont/cuba/web/app/loginwindow/loginwindow.xml"
        messagesPack="com.xxx.web.loginwindow"
        xmlns:ext="http://schemas.haulmont.com/cuba/window-ext.xsd">
    <layout>
        <vbox id="homePageMainBox"
              ext:index="1"></vbox>
    </layout>
</window>

Any help on how to work around this would be appreciated. I also tried turning ext-loginwindow.xml into a regular window representing the home page and then opening up a different screen that extends loginwindow.xml but that didn’t work either.

Hopefully really finally figured it out. I wasn’t calling super.init(params) in the init() method of the ExtAppLoginWindow.java controller.

Took me a while to track down because none of the examples in the manual require calling super.init (because you don’t need it for regular windows) and the sample-user-registration sample I was working off didn’t override init().

Sorry for the confusion. Now it is mentioned in the docs.