|
6 | 6 | __author__ = 'Simon Robinson' |
7 | 7 | __copyright__ = 'Copyright (c) 2023 Simon Robinson' |
8 | 8 | __license__ = 'Apache 2.0' |
9 | | -__version__ = '2023-12-21' # ISO 8601 (YYYY-MM-DD) |
| 9 | +__version__ = '2023-12-22' # 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 |
@@ -751,12 +751,18 @@ def get_account_with_catch_all_fallback(option): |
751 | 751 |
|
752 | 752 | try: |
753 | 753 | # if both secret values are present we use the unencrypted version (as it may have been user-edited) |
754 | | - if client_secret_encrypted and not client_secret: |
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) |
| 754 | + if client_secret_encrypted: |
| 755 | + if not client_secret: |
| 756 | + try: |
| 757 | + client_secret = cryptographer.decrypt(client_secret_encrypted) |
| 758 | + except InvalidToken as e: # needed to avoid looping (we don't remove secrets on decryption failure) |
| 759 | + Log.error('Invalid password to decrypt', username, 'secret - aborting login:', |
| 760 | + Log.error_string(e)) |
| 761 | + return False, '%s: Login failed - the password for account %s is incorrect' % ( |
| 762 | + APP_NAME, username) |
| 763 | + else: |
| 764 | + Log.info('Warning: found both `client_secret_encrypted` and `client_secret` for account', username, |
| 765 | + ' - the un-encrypted value will be used. Removing the un-encrypted value is recommended') |
760 | 766 |
|
761 | 767 | if access_token or refresh_token: # if possible, refresh the existing token(s) |
762 | 768 | if not access_token or access_token_expiry - current_time < TOKEN_EXPIRY_MARGIN: |
|
0 commit comments