1
0
mirror of https://github.com/janeczku/calibre-web synced 2024-12-26 01:50:31 +00:00

Minor formatting changes per codacy review.

This commit is contained in:
Michael Shavit 2020-01-26 01:12:52 -05:00
parent cd9bb56db5
commit d30b44ee0f
3 changed files with 5 additions and 4 deletions

View File

@ -31,7 +31,6 @@ from flask import (
request, request,
make_response, make_response,
jsonify, jsonify,
json,
url_for, url_for,
redirect, redirect,
) )

View File

@ -26,7 +26,9 @@ When first booting a Kobo device the user must sign into a Kobo (or affiliate) a
Upon successful sign-in, the user is redirected to Upon successful sign-in, the user is redirected to
https://auth.kobobooks.com/CrossDomainSignIn?id=<some id> https://auth.kobobooks.com/CrossDomainSignIn?id=<some id>
which serves the following response: which serves the following response:
<script type='text/javascript'>location.href='kobo://UserAuthenticated?userId=<redacted>&userKey<redacted>&email=<redacted>&returnUrl=https%3a%2f%2fwww.kobo.com';</script>. <script type='text/javascript'>
location.href='kobo://UserAuthenticated?userId=<redacted>&userKey<redacted>&email=<redacted>&returnUrl=https%3a%2f%2fwww.kobo.com';
</script>
And triggers the insertion of a userKey into the device's User table. And triggers the insertion of a userKey into the device's User table.
Together, the device's DeviceId and UserKey act as an *irrevocable* authentication Together, the device's DeviceId and UserKey act as an *irrevocable* authentication

View File

@ -84,7 +84,7 @@ class SyncToken():
@staticmethod @staticmethod
def from_headers(headers): def from_headers(headers):
sync_token_header = headers.get(SyncToken.SYNC_TOKEN_HEADER, "") sync_token_header = headers.get(SyncToken.SYNC_TOKEN_HEADER, "")
if sync_token_header == "": if not sync_token_header:
return SyncToken() return SyncToken()
# On the first sync from a Kobo device, we may receive the SyncToken # On the first sync from a Kobo device, we may receive the SyncToken
@ -103,7 +103,7 @@ class SyncToken():
data_json = sync_token_json["data"] data_json = sync_token_json["data"]
validate(sync_token_json, SyncToken.data_schema_v1) validate(sync_token_json, SyncToken.data_schema_v1)
except (exceptions.ValidationError, ValueError) as e: except (exceptions.ValidationError, ValueError):
log.error("Sync token contents do not follow the expected json schema.") log.error("Sync token contents do not follow the expected json schema.")
return SyncToken() return SyncToken()