N°5102 - Allow to send emails using GSuite SMTP and OAuth - Rework

This commit is contained in:
Eric Espie
2022-06-21 15:06:12 +02:00
parent ec86bd246a
commit 3f326f0913
4 changed files with 7 additions and 4 deletions

View File

@@ -17,6 +17,8 @@ Dict::Add('EN US', 'English', 'English', [
'itop-remote-authent-oauth:UsedForSMTP' => 'This connection is used for SMTP',
'itop-remote-authent-oauth:TestSMTP' => 'Email test',
'itop-remote-authent-oauth:MissingRemoteAuthentOAuth' => 'Missing Remote Authentication (OAuth) for user name %1$s',
'itop-remote-authent-oauth:Message:TokenCreated' => 'Connection token created',
'itop-remote-authent-oauth:Message:TokenRecreated' => 'Connection token regenerated',
'Class:RemoteAuthentOAuthGoogle' => 'Remote Google Authentication (OAuth)',
'Class:RemoteAuthentOAuthAzure' => 'Remote Microsoft Azure Authentication (OAuth)',

View File

@@ -1,6 +1,6 @@
<?php
//
// File generated by ... on the 2022-06-21T11:44:58+0000
// File generated by ... on the 2022-06-21T13:02:44+0000
// Please do not edit manually
//

View File

@@ -74,7 +74,7 @@ class AjaxRemoteAuthentOauthController extends Controller
$sClass,
$sId,
"$sClass:$sId:TokenCreated",
$bIsCreation ? Dict::S("RemoteAuthentOAuth:Message:TokenCreated") : Dict::S('RemoteAuthentOAuth:Message:TokenRecreated'),
$bIsCreation ? Dict::S('itop-remote-authent-oauth:Message:TokenCreated') : Dict::S('itop-remote-authent-oauth:Message:TokenRecreated'),
'ok',
1,
true

View File

@@ -138,11 +138,12 @@ function CheckEmailSetting($oP)
$sDisplayUserName = empty($sUserName) ? '<em>no user</em> ' : $sUserName;
try {
$oRemoteAuthentOAuth = OAuthClientProviderFactory::GetRemoteAuthentOAuthForSMTP();
$sLink = MetaModel::GetHyperLink(get_class($oRemoteAuthentOAuth), $oRemoteAuthentOAuth->GetKey());
$oP->info("The connection used is: $sLink");
$sProvider = $oRemoteAuthentOAuth->Get('provider');
$sDisplayProvider = empty($sProvider) ? '<em>no Provider</em> ' : $sProvider;
$sClientID = $oRemoteAuthentOAuth->Get('client_id');
$sDisplayClientID = empty($sClientID) ? '<em>no password</em> ' : $sClientID;
$oP->info("SMTP configuration (from config-itop.php): host: $sHost, port: $sPort, provider: $sDisplayProvider, user: $sDisplayUserName, client id: $sDisplayClientID, encryption: $sDisplayEncryption.");
$oP->info("SMTP configuration (from config-itop.php): host: $sHost, port: $sPort, provider: $sDisplayProvider, user: $sDisplayUserName, encryption: $sDisplayEncryption.");
if (($sHost == 'localhost') && ($sPort == '25') && ($sUserName == '') && ($sClientID == '') && ($sProvider == '')) {
$oP->warning("The default settings may not be suitable for your environment. You may want to adjust these values by editing iTop's configuration file (".utils::GetConfigFilePathRelative().').');
}