Skip to content

Commit

Permalink
Fixing misleading error message by no network available
Browse files Browse the repository at this point in the history
  • Loading branch information
SeqLaz committed Nov 27, 2024
1 parent be53ae5 commit d6ccab4
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions qfieldsync/core/cloud_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -688,6 +688,11 @@ def _on_avatar_download_finished(self, reply: QNetworkReply, filename: str) -> N
self.avatar_success.emit()

def get_last_login_error(self) -> str:
try:
requests.get(self.url, timeout=5)
except requests.ConnectionError:
return self.tr("No internet connection. Check your connection.")

if self.has_token():
return ""

Expand All @@ -704,10 +709,9 @@ def get_last_login_error(self) -> str:
if not error_str:
error_str = self.tr("Sign in failed.")

html = '<a href="https://app.qfield.cloud/accounts/password/reset/">{}?</a>'.format(
self.tr("Forgot password")
html = '<a href="{}accounts/password/reset/">{}?</a>'.format(
self.url, self.tr("Forgot password")
)

return self.tr("{}. {}").format(error_str, html)

def _clear_cloud_cookies(self, url: QUrl) -> None:
Expand Down

0 comments on commit d6ccab4

Please sign in to comment.