Skip to content

Commit

Permalink
reworked comments
Browse files Browse the repository at this point in the history
  • Loading branch information
kc committed Dec 13, 2023
1 parent 4bcf536 commit 334fbdf
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions program/include/rcmail_oauth.php
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ public function request_access_token($auth_code, $state = null)
$identity = null;

// for Kinde we need to transform "bearer" into "Bearer"
if ( stripos( strtolower ( $oauth_provider ),"kinde") !== false )
if ( stripos($oauth_provider,"kinde") !== false )
$authorization = sprintf('%s %s', ucfirst( $data['token_type']), $data['access_token']);
else
$authorization = sprintf('%s %s', $data['token_type'], $data['access_token']);
Expand Down Expand Up @@ -501,19 +501,21 @@ public function storage_init($options)
*/
public function smtp_connect($options)
{
$smtp_user = $this->options['smtp_user'];
$smtp_pass = $this->options['smtp_pass'];
$smtp_user = $options['smtp_user'];
$smtp_pass = $options['smtp_pass'];

// skip XOAUTH2 authorization, if indicated
if (($smtp_user == '') || ($smtp_pass == ''))
return $options;

if (isset($_SESSION['oauth_token'])) {
// check token validity
$this->check_token_validity($_SESSION['oauth_token']);

// skip XOAUTH2 authorization, if indicated
if (($smtp_user != '')||($smtp_pass != '')) {
$options['smtp_user'] = '%u';
$options['smtp_pass'] = '%p';
$options['smtp_auth_type'] = 'XOAUTH2';
}
// enforce XOAUTH2 authorization type
$options['smtp_user'] = '%u';
$options['smtp_pass'] = '%p';
$options['smtp_auth_type'] = 'XOAUTH2';
}

return $options;
Expand Down

0 comments on commit 334fbdf

Please sign in to comment.