GatewayException: Login failed

I am trying to process some autologin scripts which Identify the machineName for certain HMIs to be locked to particular machines and those users and passwords are retrieved from the database.
No matter what error handling I add, I cannot seem to stop the error window popping up with GatewayException: Login failed.
If there is an error with username or password, I just want to be able to default to a low-level operator login but I cannot stop this error popping up if login fails when calling,pwd)
I just put a basic example script below.
def loadHMISettings():
print ‘loading loadHMISettings’
if not,pwd):
print ‘Failed login, try default’‘operator’,‘operator’)
print ‘an exception occured’‘operator’,‘operator’)
Any suggestions?

Use validateUser() before trying to switchUser(). That’ll give you an opportunity to handle the invalid credentials before the switch.

1 Like