ome / omero-web

Django-based OMERO.web client
https://www.openmicroscopy.org/omero
16 stars 29 forks source link

Improve Error handling for inactive user login #546

Open will-moore opened 3 months ago

will-moore commented 3 months ago

See https://forum.image.sc/t/clearer-login-error-message-when-user-is-inactive/93936

When an Inactive user tries to login the message is not helpful...

Error: Connection not available, please check your user name and password.

Trying to trace this logic and error handling...

We first get SecurityViolation at https://github.com/ome/omero-py/blob/d76e17aa58ca755d239e9e8005712cd78239c62e/src/omero/gateway/__init__.py#L2185 because user is not in user group.

Then try to _createSession() again at https://github.com/ome/omero-py/blob/d76e17aa58ca755d239e9e8005712cd78239c62e/src/omero/gateway/__init__.py#L2203 but this time we don't get a SecurityViolation - instead we get

omero.ClientError Session already active. Create a new omero.client or closeSession()

but this isn't caught anywhere in the BlitzGateway - it is instead caught and ignored at

https://github.com/ome/omero-web/blob/bb3ae5cab33420ff9992e07de8614f5a5c0e234a/omeroweb/connector.py#L180

So the code that calls that at https://github.com/ome/omero-web/blob/bb3ae5cab33420ff9992e07de8614f5a5c0e234a/omeroweb/webgateway/views.py#L3424 doesn't know why the connection failed. It then generates the misleading error message above.

imagesc-bot commented 3 months ago

This issue has been mentioned on Image.sc Forum. There might be relevant details there:

https://forum.image.sc/t/clearer-login-error-message-when-user-is-inactive/93936/2