From 7dd2d3befbae73ed6a4265e020ba44b8562b02a1 Mon Sep 17 00:00:00 2001 From: Simon Li Date: Tue, 3 Jul 2018 13:52:40 +0100 Subject: [PATCH] If no tty check for missing and incorrect passwords --- components/tools/OmeroPy/src/omero/plugins/sessions.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/components/tools/OmeroPy/src/omero/plugins/sessions.py b/components/tools/OmeroPy/src/omero/plugins/sessions.py index 1e9fc4acae8..4b38e24ec38 100644 --- a/components/tools/OmeroPy/src/omero/plugins/sessions.py +++ b/components/tools/OmeroPy/src/omero/plugins/sessions.py @@ -511,15 +511,13 @@ def login(self, args): if not pasw: pasw = os.getenv("OMERO_PASSWORD") - if not pasw: - # Note: duplicating the `not pasw` check here - # for an overall nicer error message. - self._require_tty("cannot request password") - tries = 3 while True: try: if not pasw: + # Handle absent and incorrect passwords in + # non-interactive mode + self._require_tty("cannot request password") if args.sudo: prompt = "Password for %s:" % args.sudo else: