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
6 changed files with 91 additions and 27 deletions
|
@ -50,6 +50,7 @@ class PreferenceController extends Zend_Controller_Action
|
|||
Application_Model_Preference::SetMailServerEmailAddress($values["preferences_email_server"]["email"]);
|
||||
Application_Model_Preference::SetMailServerPassword($values["preferences_email_server"]["ms_password"]);
|
||||
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"]);
|
||||
|
|
|
@ -41,6 +41,15 @@ class Application_Form_EmailServerPreferences extends Zend_Form_SubForm
|
|||
'viewHelper'
|
||||
)
|
||||
));
|
||||
|
||||
$this->addElement('checkbox', 'msRequiresAuth', array(
|
||||
'label' => 'Requires Authentication',
|
||||
'required' => false,
|
||||
'value' => Application_Model_Preference::GetMailServerRequiresAuth(),
|
||||
'decorators' => array(
|
||||
'viewHelper'
|
||||
)
|
||||
));
|
||||
|
||||
$this->addElement('text', 'mailServer', array(
|
||||
'class' => 'input_text',
|
||||
|
@ -50,7 +59,9 @@ class Application_Form_EmailServerPreferences extends Zend_Form_SubForm
|
|||
'decorators' => array('viewHelper'),
|
||||
'allowEmpty' => false,
|
||||
'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'),
|
||||
'allowEmpty' => false,
|
||||
'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'),
|
||||
'allowEmpty' => false,
|
||||
'validators' => array(
|
||||
new ConditionalNotEmpty(array('configureMailServer'=>'1'))
|
||||
new ConditionalNotEmpty(array(
|
||||
'configureMailServer' => '1',
|
||||
'msRequiresAuth' => '1'
|
||||
))
|
||||
),
|
||||
'renderPassword' => true
|
||||
));
|
||||
|
|
|
@ -13,23 +13,31 @@ class Application_Model_Email
|
|||
public static function send($subject, $message, $tos, $from = null)
|
||||
{
|
||||
$mailServerConfigured = Application_Model_Preference::GetMailServerConfigured() == true ? true : false;
|
||||
$mailServerRequiresAuth = Application_Model_Preference::GetMailServerRequiresAuth() == true ? true : false;
|
||||
$success = true;
|
||||
|
||||
if ($mailServerConfigured) {
|
||||
$username = Application_Model_Preference::GetMailServerEmailAddress();
|
||||
$password = Application_Model_Preference::GetMailServerPassword();
|
||||
$mailServer = Application_Model_Preference::GetMailServer();
|
||||
$mailServerPort = Application_Model_Preference::GetMailServerPort();
|
||||
if (!empty($mailServerPort)) {
|
||||
$port = Application_Model_Preference::GetMailServerPort();
|
||||
}
|
||||
|
||||
$config = array(
|
||||
'auth' => 'login',
|
||||
'ssl' => 'ssl',
|
||||
'username' => $username,
|
||||
'password' => $password
|
||||
);
|
||||
if ($mailServerRequiresAuth) {
|
||||
$username = Application_Model_Preference::GetMailServerEmailAddress();
|
||||
$password = Application_Model_Preference::GetMailServerPassword();
|
||||
|
||||
$config = array(
|
||||
'auth' => 'login',
|
||||
'ssl' => 'ssl',
|
||||
'username' => $username,
|
||||
'password' => $password
|
||||
);
|
||||
} else {
|
||||
$config = array(
|
||||
'ssl' => 'ssl'
|
||||
);
|
||||
}
|
||||
|
||||
if (isset($port)) {
|
||||
$config['port'] = $port;
|
||||
|
|
|
@ -1089,6 +1089,16 @@ class Application_Model_Preference
|
|||
{
|
||||
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 */
|
||||
|
||||
public static function ShouldShowPopUp()
|
||||
|
|
|
@ -44,7 +44,13 @@
|
|||
<label class="required" for="mailServer"><?php echo $this->element->getElement('mailServer')->getLabel() ?>
|
||||
<span class="info-text-small">(Required)</span>:
|
||||
</label>
|
||||
|
||||
<label class="required" for="msRequiresAuth">
|
||||
<?php echo $this->element->getElement('msRequiresAuth') ?>
|
||||
<?php echo $this->element->getElement('msRequiresAuth')->getLabel() ?>
|
||||
</label>
|
||||
</dt>
|
||||
|
||||
<dd id="mailServer-element" class="block-display">
|
||||
<?php echo $this->element->getElement('mailServer') ?>
|
||||
<?php if($this->element->getElement('mailServer')->hasErrors()) : ?>
|
||||
|
@ -56,6 +62,14 @@
|
|||
<?php endif; ?>
|
||||
</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">
|
||||
<label class="required" for="email"><?php echo $this->element->getElement('email')->getLabel() ?>
|
||||
<span class="info-text-small">(Required)</span>:
|
||||
|
@ -88,14 +102,6 @@
|
|||
<?php endif; ?>
|
||||
</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 } ?>
|
||||
</dl>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue