From f7f2e1490971eac1be4ccd802a2d600fcb86fdab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sybren=20A=2E=20St=C3=BCvel?= Date: Tue, 5 Dec 2017 10:47:16 +0100 Subject: Updated Blender ID add-on to version 1.4: - Added an extra date/time format for parsing the authentication token expiry date. - Always show the "Validate" button when the user is logged in. This actively checks the token with the server, whereas the "You are logged in" only bases that statement on locally-available information (there is a token and it hasn't expired yet). --- blender_id/CHANGELOG.md | 7 +++++++ blender_id/__init__.py | 14 ++++++-------- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/blender_id/CHANGELOG.md b/blender_id/CHANGELOG.md index 201ee1d0..8c7709f7 100644 --- a/blender_id/CHANGELOG.md +++ b/blender_id/CHANGELOG.md @@ -1,5 +1,12 @@ # Blender ID Add-on Changelog +## Version 1.4 (released 2017-12-05) + +- Added an extra date/time format for parsing the authentication token expiry date. +- Always show the "Validate" button when the user is logged in. This actively checks the token with + the server, whereas the "You are logged in" only bases that statement on locally-available + information (there is a token and it hasn't expired yet). + ## Version 1.3 (released 2017-06-14) diff --git a/blender_id/__init__.py b/blender_id/__init__.py index a7094c7f..a2026581 100644 --- a/blender_id/__init__.py +++ b/blender_id/__init__.py @@ -21,7 +21,7 @@ bl_info = { 'name': 'Blender ID authentication', 'author': 'Francesco Siddi, Inês Almeida and Sybren A. Stüvel', - 'version': (1, 3, 0), + 'version': (1, 4, 0), 'blender': (2, 77, 0), 'location': 'Add-on preferences', 'description': @@ -159,8 +159,9 @@ def token_expires() -> typing.Optional[datetime.datetime]: # Try parsing as different formats. A new Blender ID is coming, # which may change the format in which timestamps are sent. formats = [ - '%Y-%m-%dT%H:%M:%S.%fZ', # ISO 8601 with Z-suffix, used by new Blender ID - '%a, %d %b %Y %H:%M:%S GMT', # RFC 1123, used by current Blender ID + '%Y-%m-%dT%H:%M:%SZ', # ISO 8601 with Z-suffix + '%Y-%m-%dT%H:%M:%S.%fZ', # ISO 8601 with fractional seconds and Z-suffix + '%a, %d %b %Y %H:%M:%S GMT', # RFC 1123, used by old Blender ID ] for fmt in formats: try: @@ -217,11 +218,9 @@ class BlenderIdPreferences(AddonPreferences): if active_profile: expiry = token_expires() now = datetime.datetime.utcnow() - show_validate_button = bpy.app.debug if expiry is None: layout.label(text='We do not know when your token expires, please validate it.') - show_validate_button = True elif now >= expiry: layout.label(text='Your login has expired! Log out and log in again to refresh it.', icon='ERROR') @@ -247,10 +246,9 @@ class BlenderIdPreferences(AddonPreferences): layout.label('You are logged in as %s. Your authentication token expires %s.' % (active_profile.username, exp_str), icon='WORLD_DATA') - row = layout.row() + row = layout.row().split(0.8) row.operator('blender_id.logout') - if show_validate_button: - row.operator('blender_id.validate') + row.operator('blender_id.validate') else: layout.prop(self, 'blender_id_username') layout.prop(self, 'blender_id_password') -- cgit v1.2.3