Tried implementing the Restore password but getting error

Hi,
I Tried implementing the Restore password but getting error on close(WINDOW_COMMIT_AND_CLOSE_ACTION); and close(WINDOW_CLOSE_ACTION);

image

image

On cancel button i want the user to get back on login page and same on send new password button

Hello!

This exception occurs if your main screen (Login or MainWindow) does not contain the WorkArea component and there is an attempt to open a screen with NEW_TAB or THIS_TAB modes. About root screens you can read in the documentation.

Have you seen the sample-user-registration demo? Please, share the code of your “Restore” and “Login” screens if you still get the issue.

Hi,
I have WorkArea component in my MainWindow but still getting the error. Please find the login and restore code attached.

ExtAppLoginWindow.java (1.1 KB)RestorePasswordScreen.java (2.8 KB)

I’ve tried your code on my app and it works as expected. Could you reproduce the issue in a new app and share it? Do you get the issue both for “Send new password” and “Cancel” buttons?

Yes I got error on both the buttons. I will try it on new app and check.

Hi,
Still getting the error. I have attached a sample project, please let me know if I am doing something wrong.

Thanks in advance.

test.zip (380.7 KB)

Thank you for the test project, now I see where the problem is! I’ve create an issue cuba-platform/cuba#3145.

As a workaround you can try to implement Window.HasWorkArea in your login screen and return a stub component.

@Inject
private UiComponents uiComponents;

@Nullable
@Override
public AppWorkArea getWorkArea() {
    // return stub
    return uiComponents.create(AppWorkArea.NAME);
}

It will work if you didn’t set specific values for cuba.web.mainTabSheetMode or cuba.web.managedMainTabSheetMode application properties.

Thanks a lot! This worked for me.