how to remove completely login

Hi All,

is it possible in a Cuba Platform application to completely remove the login page in order to directly access to the home as an anonymous user automatically logged (I need to be called by another application that has its own login)?

How to accomplish it?

Kind regards

Hi All,
probably it’s not be the best way to solve this kind of problems but it works for me, so I share the solution found: I overrode the method ready() into the extended Class for the Login Page Window, ExtAppLoginWindow, and then forcing a login action as below (e.g. using admin/admin credentials):
public class ExtAppLoginWindow extends AppLoginWindow {
@Inject
protected PasswordEncryption passwordEncryption;
@Override
public void ready() {
try {
App.getInstance().getConnection().login(“admin”,passwordEncryption.getPlainHash(“admin”), Locale.ENGLISH);
}catch(Exception ex){

}
}
}
Is there a more polite way to approach such a problem?

Hi,
To skip the login screen, you need to do the following:

  • Create a class the inheritor of com.haulmont.cuba.web.DefaultApp
  • Register newly created class in web-spring.xml, e.g.

<bean class="com.company.sample.web.App"
name="cuba_App"
scope="prototype"></bean>
  • Override the routeTopLevelWindowId() method and return screen id, which you want to be the "home" screen, e.g.

@Override
protected String routeTopLevelWindowId() {
return "mainWindow";
}
  • By setting the [url=https://doc.cuba-platform.com/manual-6.5/manual.html#cuba.anonymousLogin]cuba.anonymousLogin[/url] property you can define a user to be logged in after an application is started.
I've prepared a sample project for you on [url=https://github.com/cuba-labs/skip-login-window]github[/url]. Regards, Gleb
1 Like

Thank you very much Gleb: It makes a lot more sense now!

Best

Very good solution Gled. I have a question related to the subject. Is it possible to have a link in the main window that takes me to the login screen and enter at the admin user area?
I am building an application that lets any user perform tasks anonymously, but I require an area to configure options and enter entities.

Regards,

Your the MAN! :smile: :smile: :smile: