Skip to content

Commit

Permalink
Don't remove cache when token is invalid
Browse files Browse the repository at this point in the history
  • Loading branch information
heran yang committed Aug 19, 2023
1 parent 9154c85 commit 88c70bf
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions src/remote-wipe-service.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ void RemoteWipeService::onRequestFailed(const ApiError& error)
// but we only handle this error here to avoid complicate code since it is
// general enough.
if (error.type() == ApiError::HTTP_ERROR && error.httpErrorCode() == 401) {
askDaemonDeleteAccount(req->account());
askDaemonDeleteAccount(req->account(), false);
gui->warningBox(tr("Authorization expired, please re-login"));
gui->accountManager()->disableAccount(req->account());
active_request_count_--;
Expand All @@ -95,16 +95,16 @@ void RemoteWipeService::onRequestSuccess()
active_request_count_--;
}

void RemoteWipeService::askDaemonDeleteAccount(const Account& account)
void RemoteWipeService::askDaemonDeleteAccount(const Account& account, bool remove_cache)
{
if (!gui->rpcClient()->deleteAccount(account, true)) {
if (!gui->rpcClient()->deleteAccount(account, remove_cache)) {
qWarning() << "Failed to remove local cache of account" << account;
}
}

void RemoteWipeService::wipeLocalFiles(const Account &account)
{
qWarning("Got a remote wipe request, wiping local cache");
askDaemonDeleteAccount(account);
askDaemonDeleteAccount(account, true);
gui->accountManager()->clearAccountToken(account);
}
2 changes: 1 addition & 1 deletion src/remote-wipe-service.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ private slots:
private:
RemoteWipeService(QObject *parent=0);
void wipeLocalFiles(const Account& account);
void askDaemonDeleteAccount(const Account& account);
void askDaemonDeleteAccount(const Account& account, bool remove_cache);

QTimer *refresh_timer_;

Expand Down

0 comments on commit 88c70bf

Please sign in to comment.