Skip to content

Commit

Permalink
cleaning up linting issues
Browse files Browse the repository at this point in the history
  • Loading branch information
cantupaz committed Feb 14, 2024
1 parent 7261c4e commit ed065fe
Showing 1 changed file with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -253,11 +253,10 @@ async def validate_device(
for item in data["auth-phones"]:
phones.append(OtpPhone(item["id"], item["phone"]))
return (otp_hash, phones)
else:
self.authentication_token = response["data"]["xSValidateDevice"]["hash"]
return (None, None)

# FIXME needs testing
self.authentication_token = response["data"]["xSValidateDevice"]["hash"]
return (None, None)

async def refresh_token(self) -> bool:
"""Send a login refresh."""
content = {
Expand Down Expand Up @@ -318,11 +317,12 @@ async def login(self) -> None:
try:
response = await self._execute_request(content, "mkLoginToken")
except SecuritasDirectError as err:
(error_message, result_json, headers, content) = err.args
if result_json["data"]["xSLoginToken"]:
if result_json["data"]["xSLoginToken"]["needDeviceAuthorization"]:
# needs a 2FA
raise Login2FAError(err.args) from err
result_json = err.args[1]
if result_json["data"]:
if result_json["data"]["xSLoginToken"]:
if result_json["data"]["xSLoginToken"]["needDeviceAuthorization"]:
# needs a 2FA
raise Login2FAError(err.args) from err

raise LoginError(err.args) from err

Expand Down

0 comments on commit ed065fe

Please sign in to comment.