CC-4300: System -> Preference: Please add a option let user choose if the SMTP server requires User Authentication
-done
This commit is contained in:
parent
219fba9bee
commit
9d90e8c531
|
@ -50,6 +50,7 @@ class PreferenceController extends Zend_Controller_Action
|
||||||
Application_Model_Preference::SetMailServerEmailAddress($values["preferences_email_server"]["email"]);
|
Application_Model_Preference::SetMailServerEmailAddress($values["preferences_email_server"]["email"]);
|
||||||
Application_Model_Preference::SetMailServerPassword($values["preferences_email_server"]["ms_password"]);
|
Application_Model_Preference::SetMailServerPassword($values["preferences_email_server"]["ms_password"]);
|
||||||
Application_Model_Preference::SetMailServerPort($values["preferences_email_server"]["port"]);
|
Application_Model_Preference::SetMailServerPort($values["preferences_email_server"]["port"]);
|
||||||
|
Application_Model_Preference::SetMailServerRequiresAuth($values["preferences_email_server"]["msRequiresAuth"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
Application_Model_Preference::SetAutoUploadRecordedShowToSoundcloud($values["preferences_soundcloud"]["UseSoundCloud"]);
|
Application_Model_Preference::SetAutoUploadRecordedShowToSoundcloud($values["preferences_soundcloud"]["UseSoundCloud"]);
|
||||||
|
|
|
@ -41,6 +41,15 @@ class Application_Form_EmailServerPreferences extends Zend_Form_SubForm
|
||||||
'viewHelper'
|
'viewHelper'
|
||||||
)
|
)
|
||||||
));
|
));
|
||||||
|
|
||||||
|
$this->addElement('checkbox', 'msRequiresAuth', array(
|
||||||
|
'label' => 'Requires Authentication',
|
||||||
|
'required' => false,
|
||||||
|
'value' => Application_Model_Preference::GetMailServerRequiresAuth(),
|
||||||
|
'decorators' => array(
|
||||||
|
'viewHelper'
|
||||||
|
)
|
||||||
|
));
|
||||||
|
|
||||||
$this->addElement('text', 'mailServer', array(
|
$this->addElement('text', 'mailServer', array(
|
||||||
'class' => 'input_text',
|
'class' => 'input_text',
|
||||||
|
@ -50,7 +59,9 @@ class Application_Form_EmailServerPreferences extends Zend_Form_SubForm
|
||||||
'decorators' => array('viewHelper'),
|
'decorators' => array('viewHelper'),
|
||||||
'allowEmpty' => false,
|
'allowEmpty' => false,
|
||||||
'validators' => array(
|
'validators' => array(
|
||||||
new ConditionalNotEmpty(array('configureMailServer'=>'1'))
|
new ConditionalNotEmpty(array(
|
||||||
|
'configureMailServer' => '1'
|
||||||
|
))
|
||||||
)
|
)
|
||||||
));
|
));
|
||||||
|
|
||||||
|
@ -62,7 +73,10 @@ class Application_Form_EmailServerPreferences extends Zend_Form_SubForm
|
||||||
'decorators' => array('viewHelper'),
|
'decorators' => array('viewHelper'),
|
||||||
'allowEmpty' => false,
|
'allowEmpty' => false,
|
||||||
'validators' => array(
|
'validators' => array(
|
||||||
new ConditionalNotEmpty(array('configureMailServer'=>'1'))
|
new ConditionalNotEmpty(array(
|
||||||
|
'configureMailServer' => '1',
|
||||||
|
'msRequiresAuth' => '1'
|
||||||
|
))
|
||||||
)
|
)
|
||||||
));
|
));
|
||||||
|
|
||||||
|
@ -74,7 +88,10 @@ class Application_Form_EmailServerPreferences extends Zend_Form_SubForm
|
||||||
'decorators' => array('viewHelper'),
|
'decorators' => array('viewHelper'),
|
||||||
'allowEmpty' => false,
|
'allowEmpty' => false,
|
||||||
'validators' => array(
|
'validators' => array(
|
||||||
new ConditionalNotEmpty(array('configureMailServer'=>'1'))
|
new ConditionalNotEmpty(array(
|
||||||
|
'configureMailServer' => '1',
|
||||||
|
'msRequiresAuth' => '1'
|
||||||
|
))
|
||||||
),
|
),
|
||||||
'renderPassword' => true
|
'renderPassword' => true
|
||||||
));
|
));
|
||||||
|
|
|
@ -13,23 +13,31 @@ class Application_Model_Email
|
||||||
public static function send($subject, $message, $tos, $from = null)
|
public static function send($subject, $message, $tos, $from = null)
|
||||||
{
|
{
|
||||||
$mailServerConfigured = Application_Model_Preference::GetMailServerConfigured() == true ? true : false;
|
$mailServerConfigured = Application_Model_Preference::GetMailServerConfigured() == true ? true : false;
|
||||||
|
$mailServerRequiresAuth = Application_Model_Preference::GetMailServerRequiresAuth() == true ? true : false;
|
||||||
$success = true;
|
$success = true;
|
||||||
|
|
||||||
if ($mailServerConfigured) {
|
if ($mailServerConfigured) {
|
||||||
$username = Application_Model_Preference::GetMailServerEmailAddress();
|
|
||||||
$password = Application_Model_Preference::GetMailServerPassword();
|
|
||||||
$mailServer = Application_Model_Preference::GetMailServer();
|
$mailServer = Application_Model_Preference::GetMailServer();
|
||||||
$mailServerPort = Application_Model_Preference::GetMailServerPort();
|
$mailServerPort = Application_Model_Preference::GetMailServerPort();
|
||||||
if (!empty($mailServerPort)) {
|
if (!empty($mailServerPort)) {
|
||||||
$port = Application_Model_Preference::GetMailServerPort();
|
$port = Application_Model_Preference::GetMailServerPort();
|
||||||
}
|
}
|
||||||
|
|
||||||
$config = array(
|
if ($mailServerRequiresAuth) {
|
||||||
'auth' => 'login',
|
$username = Application_Model_Preference::GetMailServerEmailAddress();
|
||||||
'ssl' => 'ssl',
|
$password = Application_Model_Preference::GetMailServerPassword();
|
||||||
'username' => $username,
|
|
||||||
'password' => $password
|
$config = array(
|
||||||
);
|
'auth' => 'login',
|
||||||
|
'ssl' => 'ssl',
|
||||||
|
'username' => $username,
|
||||||
|
'password' => $password
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
$config = array(
|
||||||
|
'ssl' => 'ssl'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
if (isset($port)) {
|
if (isset($port)) {
|
||||||
$config['port'] = $port;
|
$config['port'] = $port;
|
||||||
|
|
|
@ -1089,6 +1089,16 @@ class Application_Model_Preference
|
||||||
{
|
{
|
||||||
return self::getValue("mail_server_port");
|
return self::getValue("mail_server_port");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function SetMailServerRequiresAuth($value)
|
||||||
|
{
|
||||||
|
self::setValue("mail_server_requires_auth", $value, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function GetMailServerRequiresAuth()
|
||||||
|
{
|
||||||
|
return self::getValue("mail_server_requires_auth");
|
||||||
|
}
|
||||||
/* User specific preferences end */
|
/* User specific preferences end */
|
||||||
|
|
||||||
public static function ShouldShowPopUp()
|
public static function ShouldShowPopUp()
|
||||||
|
|
|
@ -44,7 +44,13 @@
|
||||||
<label class="required" for="mailServer"><?php echo $this->element->getElement('mailServer')->getLabel() ?>
|
<label class="required" for="mailServer"><?php echo $this->element->getElement('mailServer')->getLabel() ?>
|
||||||
<span class="info-text-small">(Required)</span>:
|
<span class="info-text-small">(Required)</span>:
|
||||||
</label>
|
</label>
|
||||||
|
|
||||||
|
<label class="required" for="msRequiresAuth">
|
||||||
|
<?php echo $this->element->getElement('msRequiresAuth') ?>
|
||||||
|
<?php echo $this->element->getElement('msRequiresAuth')->getLabel() ?>
|
||||||
|
</label>
|
||||||
</dt>
|
</dt>
|
||||||
|
|
||||||
<dd id="mailServer-element" class="block-display">
|
<dd id="mailServer-element" class="block-display">
|
||||||
<?php echo $this->element->getElement('mailServer') ?>
|
<?php echo $this->element->getElement('mailServer') ?>
|
||||||
<?php if($this->element->getElement('mailServer')->hasErrors()) : ?>
|
<?php if($this->element->getElement('mailServer')->hasErrors()) : ?>
|
||||||
|
@ -56,6 +62,14 @@
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
</dd>
|
</dd>
|
||||||
|
|
||||||
|
<dt id="port-label" class="block-display">
|
||||||
|
<label class="required" for="port"><?php echo $this->element->getElement('port')->getLabel() ?>:
|
||||||
|
</label>
|
||||||
|
</dt>
|
||||||
|
<dd id="port-element" class="block-display">
|
||||||
|
<?php echo $this->element->getElement('port') ?>
|
||||||
|
</dd>
|
||||||
|
|
||||||
<dt id="email-label" class="block-display">
|
<dt id="email-label" class="block-display">
|
||||||
<label class="required" for="email"><?php echo $this->element->getElement('email')->getLabel() ?>
|
<label class="required" for="email"><?php echo $this->element->getElement('email')->getLabel() ?>
|
||||||
<span class="info-text-small">(Required)</span>:
|
<span class="info-text-small">(Required)</span>:
|
||||||
|
@ -88,14 +102,6 @@
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
</dd>
|
</dd>
|
||||||
|
|
||||||
<dt id="port-label" class="block-display">
|
|
||||||
<label class="required" for="port"><?php echo $this->element->getElement('port')->getLabel() ?>:
|
|
||||||
</label>
|
|
||||||
</dt>
|
|
||||||
<dd id="port-element" class="block-display">
|
|
||||||
<?php echo $this->element->getElement('port') ?>
|
|
||||||
</dd>
|
|
||||||
|
|
||||||
|
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
</dl>
|
</dl>
|
||||||
|
|
|
@ -20,14 +20,19 @@ function setConfigureMailServerListener() {
|
||||||
var configMailServer = $("#configureMailServer");
|
var configMailServer = $("#configureMailServer");
|
||||||
configMailServer.click(function(event){
|
configMailServer.click(function(event){
|
||||||
setMailServerInputReadonly();
|
setMailServerInputReadonly();
|
||||||
})
|
});
|
||||||
|
|
||||||
|
var msRequiresAuth = $("#msRequiresAuth");
|
||||||
|
msRequiresAuth.click(function(event){
|
||||||
|
setMsAuthenticationFieldsReadonly($(this));
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function setEnableSystemEmailsListener() {
|
function setEnableSystemEmailsListener() {
|
||||||
var enableSystemEmails = $("#enableSystemEmail");
|
var enableSystemEmails = $("#enableSystemEmail");
|
||||||
enableSystemEmails.click(function(event){
|
enableSystemEmails.click(function(event){
|
||||||
setSystemFromEmailReadonly();
|
setSystemFromEmailReadonly();
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function setSystemFromEmailReadonly() {
|
function setSystemFromEmailReadonly() {
|
||||||
|
@ -43,19 +48,36 @@ function setSystemFromEmailReadonly() {
|
||||||
function setMailServerInputReadonly() {
|
function setMailServerInputReadonly() {
|
||||||
var configMailServer = $("#configureMailServer");
|
var configMailServer = $("#configureMailServer");
|
||||||
var mailServer = $("#mailServer");
|
var mailServer = $("#mailServer");
|
||||||
var email = $("#email");
|
|
||||||
var password = $("#ms_password");
|
|
||||||
var port = $("#port");
|
var port = $("#port");
|
||||||
if ($(configMailServer).is(':checked')) {
|
var requiresAuthCB = $("#msRequiresAuth");
|
||||||
|
|
||||||
|
if (configMailServer.is(':checked')) {
|
||||||
mailServer.removeAttr("readonly");
|
mailServer.removeAttr("readonly");
|
||||||
email.removeAttr("readonly");
|
|
||||||
password.removeAttr("readonly");
|
|
||||||
port.removeAttr("readonly");
|
port.removeAttr("readonly");
|
||||||
|
requiresAuthCB.parent().show();
|
||||||
} else {
|
} else {
|
||||||
mailServer.attr("readonly", "readonly");
|
mailServer.attr("readonly", "readonly");
|
||||||
|
port.attr("readonly", "readonly");
|
||||||
|
requiresAuthCB.parent().hide();
|
||||||
|
}
|
||||||
|
|
||||||
|
setMsAuthenticationFieldsReadonly(requiresAuthCB);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Enable/disable mail server authentication fields
|
||||||
|
*/
|
||||||
|
function setMsAuthenticationFieldsReadonly(ele) {
|
||||||
|
var email = $("#email");
|
||||||
|
var password = $("#ms_password");
|
||||||
|
var configureMailServer = $("#configureMailServer");
|
||||||
|
|
||||||
|
if (ele.is(':checked') && configureMailServer.is(':checked')) {
|
||||||
|
email.removeAttr("readonly");
|
||||||
|
password.removeAttr("readonly");
|
||||||
|
} else if (ele.not(':checked') || configureMailServer.not(':checked')) {
|
||||||
email.attr("readonly", "readonly");
|
email.attr("readonly", "readonly");
|
||||||
password.attr("readonly", "readonly");
|
password.attr("readonly", "readonly");
|
||||||
port.attr("readonly", "readonly");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue