add oauth2 for swiftmailer
This commit is contained in:
parent
3f62cd27eb
commit
b1814a45ce
@ -292,7 +292,7 @@ if ($action == 'edit') {
|
|||||||
jQuery("#smtp_port_mess").hide();
|
jQuery("#smtp_port_mess").hide();
|
||||||
jQuery(".smtp_method").show();
|
jQuery(".smtp_method").show();
|
||||||
jQuery(".dkim").show();
|
jQuery(".dkim").show();
|
||||||
jQuery(".smtp_auth_method").hide();
|
jQuery(".smtp_auth_method").show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function change_smtp_auth_method() {
|
function change_smtp_auth_method() {
|
||||||
@ -300,6 +300,9 @@ if ($action == 'edit') {
|
|||||||
if (jQuery("#MAIN_MAIL_SENDMODE").val()==\'smtps\' && jQuery("#radio_oauth").prop("checked")) {
|
if (jQuery("#MAIN_MAIL_SENDMODE").val()==\'smtps\' && jQuery("#radio_oauth").prop("checked")) {
|
||||||
jQuery(".smtp_oauth_service").show();
|
jQuery(".smtp_oauth_service").show();
|
||||||
jQuery(".smtp_pw").hide();
|
jQuery(".smtp_pw").hide();
|
||||||
|
} else if (jQuery("#MAIN_MAIL_SENDMODE").val()==\'swiftmailer\' && jQuery("#radio_oauth").prop("checked")) {
|
||||||
|
jQuery(".smtp_oauth_service").show();
|
||||||
|
jQuery(".smtp_pw").hide();
|
||||||
} else if(jQuery("#MAIN_MAIL_SENDMODE").val()==\'mail\'){
|
} else if(jQuery("#MAIN_MAIL_SENDMODE").val()==\'mail\'){
|
||||||
jQuery(".smtp_oauth_service").hide();
|
jQuery(".smtp_oauth_service").hide();
|
||||||
jQuery(".smtp_pw").hide();
|
jQuery(".smtp_pw").hide();
|
||||||
@ -465,13 +468,13 @@ if ($action == 'edit') {
|
|||||||
if (!empty($conf->use_javascript_ajax) || (isset($conf->global->MAIN_MAIL_SENDMODE) && in_array($conf->global->MAIN_MAIL_SENDMODE, array('smtps', 'swiftmailer')))) {
|
if (!empty($conf->use_javascript_ajax) || (isset($conf->global->MAIN_MAIL_SENDMODE) && in_array($conf->global->MAIN_MAIL_SENDMODE, array('smtps', 'swiftmailer')))) {
|
||||||
print '<tr class="oddeven smtp_auth_method"><td>'.$langs->trans("MAIN_MAIL_SMTPS_AUTH_TYPE").'</td><td>';
|
print '<tr class="oddeven smtp_auth_method"><td>'.$langs->trans("MAIN_MAIL_SMTPS_AUTH_TYPE").'</td><td>';
|
||||||
if (empty($conf->multicompany->enabled) || ($user->admin && !$user->entity)) {
|
if (empty($conf->multicompany->enabled) || ($user->admin && !$user->entity)) {
|
||||||
print '<input type="radio" id="radio_pw" name="MAIN_MAIL_SMTPS_AUTH_TYPE" value="LOGIN"'.($conf->global->MAIN_MAIL_SMTPS_AUTH_TYPE == 'LOGIN' ? ' checked' : '').'> ';
|
print '<input type="radio" id="radio_pw" name="MAIN_MAIL_SMTPS_AUTH_TYPE" value="LOGIN"'.(getDolGlobalString('MAIN_MAIL_SMTPS_AUTH_TYPE') == 'LOGIN' ? ' checked' : '').'> ';
|
||||||
print '<label for="radio_pw" >'.$langs->trans("UsePassword").'</label>';
|
print '<label for="radio_pw" >'.$langs->trans("UsePassword").'</label>';
|
||||||
print ' ';
|
print ' ';
|
||||||
print '<input type="radio" id="radio_oauth" name="MAIN_MAIL_SMTPS_AUTH_TYPE" value="XOAUTH2"'.($conf->global->MAIN_MAIL_SMTPS_AUTH_TYPE == 'XOAUTH2' ? ' checked' : '').'> ';
|
print '<input type="radio" id="radio_oauth" name="MAIN_MAIL_SMTPS_AUTH_TYPE" value="XOAUTH2"'.(getDolGlobalString('MAIN_MAIL_SMTPS_AUTH_TYPE') == 'XOAUTH2' ? ' checked' : '').'> ';
|
||||||
print '<label for="radio_oauth" >'.$form->textwithpicto($langs->trans("UseOauth"), $langs->trans("OauthNotAvailableForAllAndHadToBeCreatedBefore")).'</label>';
|
print '<label for="radio_oauth" >'.$form->textwithpicto($langs->trans("UseOauth"), $langs->trans("OauthNotAvailableForAllAndHadToBeCreatedBefore")).'</label>';
|
||||||
} else {
|
} else {
|
||||||
$value = $conf->global->MAIN_MAIL_SMTPS_AUTH_TYPE;
|
$value = getDolGlobalString('MAIN_MAIL_SMTPS_AUTH_TYPE', 'LOGIN');
|
||||||
$htmltext = $langs->trans("ContactSuperAdminForChange");
|
$htmltext = $langs->trans("ContactSuperAdminForChange");
|
||||||
print $form->textwithpicto($langs->trans("MAIN_MAIL_SMTPS_AUTH_TYPE"), $htmltext, 1, 'superadmin');
|
print $form->textwithpicto($langs->trans("MAIN_MAIL_SMTPS_AUTH_TYPE"), $htmltext, 1, 'superadmin');
|
||||||
print '<input type="hidden" id="MAIN_MAIL_SMTPS_AUTH_TYPE" name="MAIN_MAIL_SMTPS_AUTH_TYPE" value="'.$value.'">';
|
print '<input type="hidden" id="MAIN_MAIL_SMTPS_AUTH_TYPE" name="MAIN_MAIL_SMTPS_AUTH_TYPE" value="'.$value.'">';
|
||||||
@ -497,7 +500,7 @@ if ($action == 'edit') {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// OAUTH service provider
|
// OAUTH service provider
|
||||||
if (!empty($conf->use_javascript_ajax) || (isset($conf->global->MAIN_MAIL_SENDMODE) && in_array($conf->global->MAIN_MAIL_SENDMODE, array('smtps')))) {
|
if (!empty($conf->use_javascript_ajax) || (isset($conf->global->MAIN_MAIL_SENDMODE) && in_array($conf->global->MAIN_MAIL_SENDMODE, array('smtps', 'swiftmailer')))) {
|
||||||
print '<tr class="oddeven smtp_oauth_service"><td>'.$langs->trans("MAIN_MAIL_SMTPS_OAUTH_SERVICE").'</td><td>';
|
print '<tr class="oddeven smtp_oauth_service"><td>'.$langs->trans("MAIN_MAIL_SMTPS_OAUTH_SERVICE").'</td><td>';
|
||||||
|
|
||||||
// SuperAdministrator access only
|
// SuperAdministrator access only
|
||||||
@ -699,19 +702,19 @@ if ($action == 'edit') {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// AUTH method
|
// AUTH method
|
||||||
if (isset($conf->global->MAIN_MAIL_SENDMODE) && in_array($conf->global->MAIN_MAIL_SENDMODE, array('smtps'))) {
|
if (isset($conf->global->MAIN_MAIL_SENDMODE) && in_array($conf->global->MAIN_MAIL_SENDMODE, array('smtps', 'swiftmailer'))) {
|
||||||
$authtype = $conf->global->MAIN_MAIL_SMTPS_AUTH_TYPE;
|
$authtype = getDolGlobalString('MAIN_MAIL_SMTPS_AUTH_TYPE', 'LOGIN');
|
||||||
$text = ($authtype === "LOGIN") ? $langs->trans("UsePassword") : ($authtype === "XOAUTH2" ? $langs->trans("UseOauth") : '') ;
|
$text = ($authtype === "LOGIN") ? $langs->trans("UsePassword") : ($authtype === "XOAUTH2" ? $langs->trans("UseOauth") : '') ;
|
||||||
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_SMTPS_AUTH_TYPE").'</td><td>'.$text.'</td></tr>';
|
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_SMTPS_AUTH_TYPE").'</td><td>'.$text.'</td></tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
// SMTPS PW
|
// SMTPS PW
|
||||||
if (isset($conf->global->MAIN_MAIL_SENDMODE) && (in_array($conf->global->MAIN_MAIL_SENDMODE, array('swiftmailer')) || (in_array($conf->global->MAIN_MAIL_SENDMODE, array('smtps')) && (isset($conf->global->MAIN_MAIL_SMTPS_AUTH_TYPE) && $conf->global->MAIN_MAIL_SMTPS_AUTH_TYPE === "LOGIN")))) {
|
if (isset($conf->global->MAIN_MAIL_SENDMODE) && (in_array($conf->global->MAIN_MAIL_SENDMODE, array('swiftmailer')) || (in_array($conf->global->MAIN_MAIL_SENDMODE, array('smtps')) && getDolGlobalString('MAIN_MAIL_SMTPS_AUTH_TYPE') === "LOGIN"))) {
|
||||||
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_SMTPS_PW").'</td><td>'.preg_replace('/./', '*', $conf->global->MAIN_MAIL_SMTPS_PW).'</td></tr>';
|
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_SMTPS_PW").'</td><td>'.preg_replace('/./', '*', $conf->global->MAIN_MAIL_SMTPS_PW).'</td></tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
// SMTPS oauth service
|
// SMTPS oauth service
|
||||||
if (isset($conf->global->MAIN_MAIL_SENDMODE) && in_array($conf->global->MAIN_MAIL_SENDMODE, array('smtps')) && isset($conf->global->MAIN_MAIL_SMTPS_AUTH_TYPE) && $conf->global->MAIN_MAIL_SMTPS_AUTH_TYPE === "XOAUTH2") {
|
if (isset($conf->global->MAIN_MAIL_SENDMODE) && in_array($conf->global->MAIN_MAIL_SENDMODE, array('smtps')) && getDolGlobalString('MAIN_MAIL_SMTPS_AUTH_TYPE') === "XOAUTH2") {
|
||||||
$text = $oauthservices[$conf->global->MAIN_MAIL_SMTPS_OAUTH_SERVICE];
|
$text = $oauthservices[$conf->global->MAIN_MAIL_SMTPS_OAUTH_SERVICE];
|
||||||
if (empty($text)) {
|
if (empty($text)) {
|
||||||
$text = $langs->trans("Undefined").img_warning();
|
$text = $langs->trans("Undefined").img_warning();
|
||||||
|
|||||||
@ -2291,5 +2291,5 @@ OauthNotAvailableForAllAndHadToBeCreatedBefore=L'authentification OAUTH2 n'est p
|
|||||||
MAIN_MAIL_SMTPS_OAUTH_SERVICE=Service d'authentification OAUTH2
|
MAIN_MAIL_SMTPS_OAUTH_SERVICE=Service d'authentification OAUTH2
|
||||||
DontForgetCreateTokenOauthMod=Un jeton avec les bonnes permissions doit avoir été créé en amont avec le module OAUTH
|
DontForgetCreateTokenOauthMod=Un jeton avec les bonnes permissions doit avoir été créé en amont avec le module OAUTH
|
||||||
MAIN_MAIL_SMTPS_AUTH_TYPE=Méthode d'authentication
|
MAIN_MAIL_SMTPS_AUTH_TYPE=Méthode d'authentication
|
||||||
UsePassword=Utiliser un mot de pass
|
UsePassword=Utiliser un mot de passe
|
||||||
UseOauth=Utiliser un jeton d'authentification OAUTH
|
UseOauth=Utiliser un jeton d'authentification OAUTH
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user