diff --git a/lam/docs/manual-sources/howto.xml b/lam/docs/manual-sources/howto.xml
index e3a2082e..58f19d0f 100644
--- a/lam/docs/manual-sources/howto.xml
+++ b/lam/docs/manual-sources/howto.xml
@@ -1286,6 +1286,21 @@ Have fun!
the script is located. The default rights for new home directories
can be set, too.
+
+
+
+
+
+
+
+
+ LAM Pro users can send out changed passwords to their users.
+ Here you can specify the options for these mails.
+
+ If you select "Allow alternate address" then password mails
+ can be sent to any address (e.g. a secondary address if the user
+ account is also bound to the mailbox).
+
diff --git a/lam/docs/manual-sources/images/configProfiles9.png b/lam/docs/manual-sources/images/configProfiles9.png
new file mode 100644
index 00000000..3d50903d
Binary files /dev/null and b/lam/docs/manual-sources/images/configProfiles9.png differ
diff --git a/lam/help/help.inc b/lam/help/help.inc
index 8c242953..5eb6d127 100644
--- a/lam/help/help.inc
+++ b/lam/help/help.inc
@@ -250,6 +250,8 @@ $helpArray = array (
"Text" => _('Specifies if the mail should be sent as text or HTML.')),
"554" => array ("Headline" => _("Reply-to address"),
"Text" => _("This email address will be set as reply-to address of all password mails.")),
+ "555" => array ("Headline" => _("Allow alternate address"),
+ "Text" => _('Specifies if password mails may be sent to mail addresses other than the user\'s LDAP mail address.')),
// 600 - 699
// OU-editor, domain page
"601" => array ("Headline" => _("OU-Editor") . " - " . _("New organisational unit"),
diff --git a/lam/lib/config.inc b/lam/lib/config.inc
index 6561c155..39db0054 100644
--- a/lam/lib/config.inc
+++ b/lam/lib/config.inc
@@ -407,6 +407,9 @@ class LAMConfig {
/** treat password reset mail body as HTML */
private $lamProMailIsHTML = 'false';
+ /** allow sending mails to an alternative address */
+ private $lamProMailAllowAlternateAddress = 'true';
+
/** mail body for password reset mails */
private $lamProMailText = '';
@@ -415,7 +418,8 @@ class LAMConfig {
"defaultLanguage", "scriptPath", "scriptServer", "scriptRights", "cachetimeout",
"modules", "activeTypes", "types", "tools", "accessLevel", 'loginMethod', 'loginSearchSuffix',
'loginSearchFilter', 'searchLimit', 'lamProMailFrom', 'lamProMailReplyTo', 'lamProMailSubject',
- 'lamProMailText', 'lamProMailIsHTML', 'httpAuthentication', 'loginSearchDN', 'loginSearchPassword');
+ 'lamProMailText', 'lamProMailIsHTML', 'lamProMailAllowAlternateAddress', 'httpAuthentication', 'loginSearchDN',
+ 'loginSearchPassword');
/**
@@ -603,6 +607,7 @@ class LAMConfig {
if (!in_array("lamProMailReplyTo", $saved)) array_push($file_array, "\n\n# Password mail reply-to\n" . "lamProMailReplyTo: " . $this->lamProMailReplyTo . "\n");
if (!in_array("lamProMailSubject", $saved)) array_push($file_array, "\n\n# Password mail subject\n" . "lamProMailSubject: " . $this->lamProMailSubject . "\n");
if (!in_array("lamProMailIsHTML", $saved)) array_push($file_array, "\n\n# Password mail is HTML\n" . "lamProMailIsHTML: " . $this->lamProMailIsHTML . "\n");
+ if (!in_array("lamProMailAllowAlternateAddress", $saved)) array_push($file_array, "\n\n# Allow alternate address\n" . "lamProMailAllowAlternateAddress: " . $this->lamProMailAllowAlternateAddress . "\n");
if (!in_array("lamProMailText", $saved)) array_push($file_array, "\n\n# Password mail text\n" . "lamProMailText: " . $this->lamProMailText . "\n");
// check if all module settings were added
$m_settings = array_keys($this->moduleSettings);
@@ -1402,12 +1407,30 @@ class LAMConfig {
/**
* Sets if the password reset mail content should be treated as HTML.
*
- * @param boolean $lamProMailIsHTML
+ * @param boolean $lamProMailIsHTML true if HTML
*/
public function setLamProMailIsHTML($lamProMailIsHTML) {
$this->lamProMailIsHTML = $lamProMailIsHTML;
}
+ /**
+ * Returns if sending to an alternate address is allowed.
+ *
+ * @return boolean alternate address allowed
+ */
+ public function getLamProMailAllowAlternateAddress() {
+ return $this->lamProMailAllowAlternateAddress;
+ }
+
+ /**
+ * Sets if sending to an alternate address is allowed.
+ *
+ * @param boolean $lamProMailAllowAlternateAddress alternate address allowed
+ */
+ public function setLamProMailAllowAlternateAddress($lamProMailAllowAlternateAddress) {
+ $this->lamProMailAllowAlternateAddress = $lamProMailAllowAlternateAddress;
+ }
+
/**
* Returns the mail body for password reset mails.
*
diff --git a/lam/lib/modules.inc b/lam/lib/modules.inc
index 5932b3fa..31bd568e 100644
--- a/lam/lib/modules.inc
+++ b/lam/lib/modules.inc
@@ -1061,7 +1061,9 @@ class accountContainer {
$pwdMailCheckbox->setTableRowsToShow(array('lamPasswordChangeSendMailAddress'));
$container->addElement($pwdMailCheckbox);
$container->addElement(new htmlHelpLink('407'), true);
- $container->addElement(new htmlTableExtendedInputField(_('Alternate recipient'), 'lamPasswordChangeSendMailAddress', '', '410'));
+ if (($_SESSION['config']->getLamProMailAllowAlternateAddress() != 'false')) {
+ $container->addElement(new htmlTableExtendedInputField(_('Alternate recipient'), 'lamPasswordChangeSendMailAddress', '', '410'));
+ }
}
$container->addElement(new htmlSpacer(null, '10px'), true);
// password modules
@@ -1157,7 +1159,7 @@ class accountContainer {
}
if (isLAMProVersion() && $sendMail) {
$this->sendPasswordViaMail = $password1;
- if (!empty($input['sendMailAlternateAddress'])) {
+ if (($_SESSION['config']->getLamProMailAllowAlternateAddress() != 'false') && !empty($input['sendMailAlternateAddress'])) {
if (!get_preg($input['sendMailAlternateAddress'], 'email')) {
$return['messages'] .= StatusMessage('ERROR', _('Alternate recipient'), _('Please enter a valid email address!'), array(), true);
$return['errorsOccured'] = 'true';
diff --git a/lam/templates/config/confmain.php b/lam/templates/config/confmain.php
index 318543b0..b7cf3ee3 100644
--- a/lam/templates/config/confmain.php
+++ b/lam/templates/config/confmain.php
@@ -355,6 +355,12 @@ if (isLAMProVersion()) {
}
$pwdMailContent->addElement(new htmlTableExtendedInputCheckbox('pwdResetMail_isHTML',$pwdMailIsHTML , _('HTML format'), '553'), true);
+ $pwdMailAllowAlternate = true;
+ if ($conf->getLamProMailAllowAlternateAddress() == 'false') {
+ $pwdMailAllowAlternate = false;
+ }
+ $pwdMailContent->addElement(new htmlTableExtendedInputCheckbox('pwdResetMail_allowAlternate',$pwdMailAllowAlternate , _('Allow alternate address'), '555'), true);
+
$pwdMailBody = new htmlTableExtendedInputTextarea('pwdResetMail_body', $conf->getLamProMailText(), 50, 4, _('Text'), '552');
$pwdMailContent->addElement($pwdMailBody, true);
@@ -522,6 +528,12 @@ function checkInput() {
else {
$conf->setLamProMailIsHTML('false');
}
+ if (isset($_POST['pwdResetMail_allowAlternate']) && ($_POST['pwdResetMail_allowAlternate'] == 'on')) {
+ $conf->setLamProMailAllowAlternateAddress('true');
+ }
+ else {
+ $conf->setLamProMailAllowAlternateAddress('false');
+ }
$conf->setLamProMailText($_POST['pwdResetMail_body']);
}
$adminText = $_POST['admins'];
diff --git a/lam/templates/lib/500_lam.js b/lam/templates/lib/500_lam.js
index 3e476b32..c6eb19e8 100644
--- a/lam/templates/lib/500_lam.js
+++ b/lam/templates/lib/500_lam.js
@@ -253,7 +253,10 @@ function passwordHandleInput(random, ajaxURL) {
var pwd2 = jQuery('#passwordDialog').find('[name=newPassword2]').val();
var forcePasswordChange = jQuery('input[name=lamForcePasswordChange]').prop('checked');
var sendMail = jQuery('input[name=lamPasswordChangeSendMail]').prop('checked');
- var sendMailAlternateAddress = jQuery('#passwordDialog').find('[name=lamPasswordChangeSendMailAddress]').val();
+ var sendMailAlternateAddress = '';
+ if (jQuery('#passwordDialog').find('[name=lamPasswordChangeSendMailAddress]')) {
+ sendMailAlternateAddress = jQuery('#passwordDialog').find('[name=lamPasswordChangeSendMailAddress]').val();
+ }
var pwdJSON = {
"modules": modules,
"password1": pwd1,