Skip to content

Commit

Permalink
Do not erase valid refresh tokens during SMTP Oauth connection
Browse files Browse the repository at this point in the history
  • Loading branch information
cedric-anne committed Apr 29, 2024
1 parent 68efe6a commit eaf9b59
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/GLPIMailer.php
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,8 @@ public function smtpConnect($options = null)
if (
$this->oauth instanceof OAuthTokenProvider
&& $result === true
&& ($refresh_token = $this->oauth->getOauthToken()->getRefreshToken() ?? null) !== (new GLPIKey())->decrypt($CFG_GLPI['smtp_oauth_refresh_token'])
&& ($refresh_token = $this->oauth->getOauthToken()->getRefreshToken() ?? null) !== null
&& $refresh_token !== (new GLPIKey())->decrypt($CFG_GLPI['smtp_oauth_refresh_token'])
) {
// The refresh token may be refreshed itself.
// Be sure to always store any new refresh token.
Expand Down

0 comments on commit eaf9b59

Please sign in to comment.