Do not re-auth on --logout (#1705)

* When issuing a --logout, do not perform a reauthentication of the application
This commit is contained in:
abraunegg 2021-11-17 06:05:11 +11:00 committed by GitHub
parent 6febb13408
commit cceb3cccdd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -498,21 +498,26 @@ int main(string[] args)
cfg.setValueBool("resync", true);
}
// Handle --resync and --logout to remove local files
if (cfg.getValueBool("resync") || cfg.getValueBool("logout")) {
// Handle --logout as separate item, do not 'resync' on a --logout / reauth
if (cfg.getValueBool("logout")) {
log.vdebug("--logout requested");
log.log("Deleting the saved authentication status ...");
if (!cfg.getValueBool("dry_run")) {
safeRemove(cfg.refreshTokenFilePath);
}
// Exit
return EXIT_SUCCESS;
}
// Handle --resync to remove local files
if (cfg.getValueBool("resync")) {
if (cfg.getValueBool("resync")) log.vdebug("--resync requested");
log.vlog("Deleting the saved status ...");
log.log("Deleting the saved application sync status ...");
if (!cfg.getValueBool("dry_run")) {
safeRemove(cfg.databaseFilePath);
safeRemove(cfg.deltaLinkFilePath);
safeRemove(cfg.uploadStateFilePath);
}
if (cfg.getValueBool("logout")) {
log.vdebug("--logout requested");
if (!cfg.getValueBool("dry_run")) {
safeRemove(cfg.refreshTokenFilePath);
}
}
}
// Display current application configuration, no application initialisation