Please, is it possible to suppress the red popup Error window “Login failed” when operator enters invalid logname and/or password?
No, they cannot be suppressed or turned off. The only way that you would be able to work around this is to have your own custom logon screen. You would set the project to auto logon in the project properties then have your own screen appear for the user to log in.
Thank you Greg. Well, I already have auto logon and the red popup appears from my user login (small popup window translated from your Skeleton project’s “Switch User” label) anyway.
I think gateway throws this Error (and the red Error popup) anyway if login username or password are incorrect.
This would be no problem if all the system texts (in system menus, error popups…) could be translated. Otherwise (when the project has been made in another language) it looks not very professional when english popups are appearing.
There is an extra parameter on the system.security.switchUser function which allows you to suppress this error.
To try this, create your own custom login window as Greg suggested - make it the same size as your main window and put a text field, a password field and a login button on it. In the login button’s actionPerformed event put the following code:[code]username = event.source.parent.getComponent(‘txtUsername’)
password = event.source.parent.getComponent(‘pwdPassword’)
success = system.security.switchUser(username.text, password.text, event, hideError=True)
Open up the appropriate main window - this can be user-specific if you want
If the login didn’t work, give input focus back to the username component, so that the user can try again
username.requestFocusInWindow() system.gui.errorBox("Login failed", "Error")[/code]You can now display whatever text you want on a failed login attempt.
If you are using auto login with a custom login window and are still displaying the Ignition menu at the top of the window, bear in mind that if the user presses Logout, the normal Ignition Login window will be displayed. You will have to edit the code behind the Logout button so it automatically logs in and displays your custom login window. Put code like the following into the Client Event Script for the Menubar Logout command:[code]# If the dummy “login” user is logged in, do nothing and exit
username = system.tag.getTagValue("[System]Client/User/Username")
if username == “login”:
Close all the open windows
for window in system.gui.getOpenedWindowNames():
Open the standard login window
#Change the current user to the login user
success = system.security.switchUser(‘login’, ‘login’)
If the login didn’t work, warn the user - the should never happen!
if not success:
AlThePal, thank you soooo much.
I misunderstood what Greg wrote. I already had autologin and own small popup login window (from template Skeleton project only translated to our language) and red Error popup appeared anyway.
But I didn’t know the magic parameter ‘‘hideError=True’’.