|
6 | 6 | __author__ = 'Simon Robinson' |
7 | 7 | __copyright__ = 'Copyright (c) 2023 Simon Robinson' |
8 | 8 | __license__ = 'Apache 2.0' |
9 | | -__version__ = '2023-11-18' # ISO 8601 (YYYY-MM-DD) |
| 9 | +__version__ = '2023-12-18' # ISO 8601 (YYYY-MM-DD) |
10 | 10 | __package_version__ = '.'.join([str(int(i)) for i in __version__.split('-')]) # for pyproject.toml usage only |
11 | 11 |
|
12 | 12 | import abc |
@@ -340,10 +340,10 @@ def save(store_id, config_dict): |
340 | 340 |
|
341 | 341 |
|
342 | 342 | class AWSSecretsManagerCacheStore(CacheStore): |
343 | | - # noinspection PyGlobalUndefined,PyPackageRequirements |
344 | 343 | @staticmethod |
345 | 344 | def _get_boto3_client(store_id): |
346 | 345 | try: |
| 346 | + # noinspection PyGlobalUndefined |
347 | 347 | global boto3, botocore |
348 | 348 | import boto3 |
349 | 349 | import botocore.exceptions |
@@ -752,7 +752,11 @@ def get_account_with_catch_all_fallback(option): |
752 | 752 | try: |
753 | 753 | # if both secret values are present we use the unencrypted version (as it may have been user-edited) |
754 | 754 | if client_secret_encrypted and not client_secret: |
755 | | - client_secret = cryptographer.decrypt(client_secret_encrypted) |
| 755 | + try: |
| 756 | + client_secret = cryptographer.decrypt(client_secret_encrypted) |
| 757 | + except InvalidToken as e: # needed to avoid looping as we don't remove secrets on decryption failure |
| 758 | + Log.error('Invalid password to decrypt', username, 'secret - aborting login:', Log.error_string(e)) |
| 759 | + return False, '%s: Login failed - the password for account %s is incorrect' % (APP_NAME, username) |
756 | 760 |
|
757 | 761 | if access_token or refresh_token: # if possible, refresh the existing token(s) |
758 | 762 | if not access_token or access_token_expiry - current_time < TOKEN_EXPIRY_MARGIN: |
@@ -2270,7 +2274,9 @@ class App: |
2270 | 2274 | """Manage the menu bar icon, server loading, authorisation and notifications, and start the main proxy thread""" |
2271 | 2275 |
|
2272 | 2276 | def __init__(self, args=None): |
2273 | | - global CONFIG_FILE_PATH, CACHE_STORE, EXITING, prompt_toolkit |
| 2277 | + # noinspection PyGlobalUndefined |
| 2278 | + global prompt_toolkit |
| 2279 | + global CONFIG_FILE_PATH, CACHE_STORE, EXITING |
2274 | 2280 | EXITING = False # needed to allow restarting when imported from parent scripts (or an interpreter) |
2275 | 2281 |
|
2276 | 2282 | parser = argparse.ArgumentParser(description='%s: transparently add OAuth 2.0 support to IMAP/POP/SMTP client ' |
|
0 commit comments