Skip to content

Commit

Permalink
Skip adding preset with OAUTH when not logged on via OAUTH
Browse files Browse the repository at this point in the history
Effectively, this replaces an ERROR-level log entry with an INFO-level
log entry, since in such cases, the preset is not applicable for the
user.
  • Loading branch information
mstilkerich committed Jul 13, 2021
1 parent 46027b6 commit 9f4c049
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion carddav.php
Original file line number Diff line number Diff line change
Expand Up @@ -280,9 +280,14 @@ public function initPresets(): void
$username = self::replacePlaceholdersUsername($preset['username']);
$url = self::replacePlaceholdersUrl($preset['url']);
$password = self::replacePlaceholdersPassword($preset['password']);
try {
$account = Config::makeAccount($url, $username, $password, null);
} catch (\Exception $e) {
$logger->info("Skip adding preset for $username: required bearer token not available");
continue;
}

$logger->info("Adding preset for $username at URL $url");
$account = Config::makeAccount($url, $username, $password, null);
$abooks = $this->determineAddressbooksToAdd($account);

foreach ($abooks as $abook) {
Expand Down

0 comments on commit 9f4c049

Please sign in to comment.