reply-to for password reset mails

This commit is contained in:
Roland Gruber 2011-08-15 12:33:04 +00:00
parent c33e212295
commit 14901fa203
3 changed files with 36 additions and 1 deletions

View File

@ -194,6 +194,8 @@ $helpArray = array (
'<li>' . _('The wildcard for the new password is @@newPassword@@.') . '</li>'),
"553" => array ("Headline" => _("HTML format"),
"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.")),
// 600 - 699
// OU-editor, domain page
"601" => array ("Headline" => _("OU-Editor") . " - " . _("New organisational unit"),

View File

@ -257,6 +257,9 @@ class LAMConfig {
/** email address for sender of password reset mails */
private $lamProMailFrom = '';
/** reply-to email address for password reset mails */
private $lamProMailReplyTo = '';
/** subject for password reset mails */
private $lamProMailSubject = '';
@ -270,7 +273,7 @@ class LAMConfig {
private $settings = array("ServerURL", "useTLS", "Passwd", "Admins", "treesuffix",
"defaultLanguage", "scriptPath", "scriptServer", "scriptRights", "cachetimeout",
"modules", "activeTypes", "types", "accessLevel", 'loginMethod', 'loginSearchSuffix',
'loginSearchFilter', 'searchLimit', 'lamProMailFrom', 'lamProMailSubject',
'loginSearchFilter', 'searchLimit', 'lamProMailFrom', 'lamProMailReplyTo', 'lamProMailSubject',
'lamProMailText', 'lamProMailIsHTML');
@ -423,6 +426,7 @@ class LAMConfig {
if (!in_array("loginSearchSuffix", $saved)) array_push($file_array, "\n\n# Search suffix for LAM login.\n" . "loginSearchSuffix: " . $this->loginSearchSuffix . "\n");
if (!in_array("loginSearchFilter", $saved)) array_push($file_array, "\n\n# Search filter for LAM login.\n" . "loginSearchFilter: " . $this->loginSearchFilter . "\n");
if (!in_array("lamProMailFrom", $saved)) array_push($file_array, "\n\n# Password mail from\n" . "lamProMailFrom: " . $this->lamProMailFrom . "\n");
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("lamProMailText", $saved)) array_push($file_array, "\n\n# Password mail text\n" . "lamProMailText: " . $this->lamProMailText . "\n");
@ -1059,6 +1063,29 @@ class LAMConfig {
return true;
}
/**
* Returns the reply-to address for password reset mails.
*
* @return String mail address
*/
public function getLamProMailReplyTo() {
return $this->lamProMailReplyTo;
}
/**
* Sets the reply-to address for password reset mails.
*
* @param String $lamProMailReplyTo mail address
* @return boolean true if address is valid
*/
public function setLamProMailReplyTo($lamProMailReplyTo) {
$this->lamProMailReplyTo = $lamProMailReplyTo;
if (($lamProMailReplyTo != '') && !get_preg($lamProMailReplyTo, 'email') && !get_preg($lamProMailReplyTo, 'emailWithName')) {
return false;
}
return true;
}
/**
* Returns the subject for password reset mails.
*

View File

@ -314,6 +314,9 @@ if (isLAMProVersion()) {
$pwdMailFrom = new htmlTableExtendedInputField(_('From address'), 'pwdResetMail_from', $conf->getLamProMailFrom(), '550');
$pwdMailContent->addElement($pwdMailFrom, true);
$pwdMailReplyTo = new htmlTableExtendedInputField(_('Reply-to address'), 'pwdResetMail_replyTo', $conf->getLamProMailReplyTo(), '554');
$pwdMailContent->addElement($pwdMailReplyTo, true);
$pwdMailSubject = new htmlTableExtendedInputField(_('Subject'), 'pwdResetMail_subject', $conf->getLamProMailSubject(), '551');
$pwdMailContent->addElement($pwdMailSubject, true);
@ -418,6 +421,9 @@ function checkInput() {
if (!$conf->setLamProMailFrom($_POST['pwdResetMail_from'])) {
$errors[] = array("ERROR", _("From address for password mails is invalid."), $_POST['pwdResetMail_from']);
}
if (!$conf->setLamProMailReplyTo($_POST['pwdResetMail_replyTo'])) {
$errors[] = array("ERROR", _("Reply-to address for password mails is invalid."), $_POST['pwdResetMail_replyTo']);
}
$conf->setLamProMailSubject($_POST['pwdResetMail_subject']);
if (isset($_POST['pwdResetMail_isHTML']) && ($_POST['pwdResetMail_isHTML'] == 'on')) {
$conf->setLamProMailIsHTML('true');