diff --git a/lam/config/lam.conf_sample b/lam/config/lam.conf_sample
index 72667812..7ffed9ce 100644
--- a/lam/config/lam.conf_sample
+++ b/lam/config/lam.conf_sample
@@ -68,3 +68,9 @@ types: suffix_smbDomain: dc=my-domain,dc=com
types: attr_smbDomain: sambaDomainName:Domain name;sambaSID:Domain SID
types: modules_smbDomain: sambaDomain
+# Password mail subject
+lamProMailSubject: Your password was reset
+
+# Password mail text
+lamProMailText: Dear @@givenName@@ @@sn@@,+::++::+your password was reset to: @@newPassword@@+::++::++::+Best regards+::++::+deskside support+::+
+
diff --git a/lam/help/help.inc b/lam/help/help.inc
index 5cfeaed1..b091ccd5 100644
--- a/lam/help/help.inc
+++ b/lam/help/help.inc
@@ -45,10 +45,7 @@ for ($i = 0; $i < sizeof($types); $i++) {
}
$helpArray = array (
- // 0 - 99
- // any developer
// 200 - 299
- // Roland Gruber
// configuration wizard
// configuration login
// config profile management
@@ -147,7 +144,6 @@ $helpArray = array (
"250" => array ("Headline" => _("Filter"),
"Text" => _("Here you can input simple filter expressions (e.g. 'value' or 'v*'). The filter is case-sensitive.")),
// 300 - 399
- // Roland Gruber
// profile editor, file upload
"301" => array ("Headline" => _("RDN identifier"),
"Text" => _("This is the identifier for the relative DN value. It must be one of the given allowed LDAP attributes (e.g. user accounts usually use \"uid\" while groups use \"cn\").")),
@@ -164,7 +160,6 @@ $helpArray = array (
"404" => array ("Headline" => _("Password"),
"Text" => _("Please enter the password which you want to set for this account. You may also generate a random password (12 characters) which will be displayed on your screen.")),
// 500 - 599
- // Roland Gruber
// LAM Pro
"501" => array ("Headline" => _("LDAP suffix"),
"Text" => _("LAM will search for accounts in this part of the LDAP tree.")),
@@ -194,8 +189,16 @@ $helpArray = array (
'
' . _('All following lines form the mail body.') . '
' .
'
' . _('You can use wildcards for LDAP attributes in the form @@attribute@@ (e.g. @@uid@@ for the user name).') . '
' .
'
' . _('The wildcard for the new password is @@newPassword@@.') . '
'),
+ "550" => array ("Headline" => _("From address"),
+ "Text" => _("This email address will be set as sender address of all password mails. If empty the system default (php.ini) will be used.")),
+ "551" => array ("Headline" => _("Subject"),
+ "Text" => _('The subject of all password mails. If empty the first line of "config/passwordMailTemplate.txt" will be used.')),
+ "552" => array ("Headline" => _("Text"),
+ "Text" => _('The mail text of all password mails. If empty the content of "config/passwordMailTemplate.txt" starting at the second line will be used.') .
+ '
' . _('Format') . ':
' .
+ '
' . _('You can use wildcards for LDAP attributes in the form @@attribute@@ (e.g. @@uid@@ for the user name).') . '
' .
+ '
' . _('The wildcard for the new password is @@newPassword@@.') . '
'),
// 600 - 699
- // Roland Gruber
// OU-editor, domain page
"601" => array ("Headline" => _("OU-Editor") . " - " . _("New organizational unit"),
"Text" => _("This will create a new organizational unit under the selected one.")),
diff --git a/lam/lib/config.inc b/lam/lib/config.inc
index e4909c47..ea060bcd 100644
--- a/lam/lib/config.inc
+++ b/lam/lib/config.inc
@@ -175,6 +175,9 @@ class LAMConfig {
/* login method: predefined list or LDAP search */
const LOGIN_LIST = 'list';
const LOGIN_SEARCH = 'search';
+
+ /** line separator */
+ const LINE_SEPARATOR = '+::+';
/** Server address (e.g. ldap://127.0.0.1:389) */
private $ServerURL;
@@ -244,12 +247,21 @@ class LAMConfig {
/** search filter for login */
private $loginSearchFilter = 'uid=%USER%';
+
+ /** email address for sender of password reset mails */
+ private $lamProMailFrom = '';
+
+ /** subject for password reset mails */
+ private $lamProMailSubject = '';
+
+ /** mail body for password reset mails */
+ private $lamProMailText = '';
/** List of all settings in config file */
private $settings = array("ServerURL", "useTLS", "Passwd", "Admins", "treesuffix",
"defaultLanguage", "scriptPath", "scriptServer", "scriptRights", "cachetimeout",
"modules", "activeTypes", "types", "accessLevel", 'loginMethod', 'loginSearchSuffix',
- 'loginSearchFilter', 'searchLimit');
+ 'loginSearchFilter', 'searchLimit', 'lamProMailFrom', 'lamProMailSubject', 'lamProMailText');
/**
@@ -290,7 +302,7 @@ class LAMConfig {
if (strtolower(substr($line, 0, $keylen + 2)) == "modules: ") {
$option = substr($line, $keylen + 2, strlen($line) - $keylen - 2);
$pos = strpos($option, ":");
- $this->moduleSettings[substr($option, 0, $pos)] = explode("+::+", substr($option, $pos + 2));
+ $this->moduleSettings[substr($option, 0, $pos)] = explode(LAMConfig::LINE_SEPARATOR, substr($option, $pos + 2));
}
// type settings
elseif (strtolower(substr($line, 0, $keylen + 2)) == "types: ") {
@@ -357,7 +369,7 @@ class LAMConfig {
$pos = strpos($option, ":");
$name = substr($option, 0, $pos);
if (!isset($this->moduleSettings[$name])) continue;
- $file_array[$i] = "modules: " . $name . ": " . implode("+::+", $this->moduleSettings[$name]) . "\n";
+ $file_array[$i] = "modules: " . $name . ": " . implode(LAMConfig::LINE_SEPARATOR, $this->moduleSettings[$name]) . "\n";
$mod_saved[] = $name; // mark keyword as saved
}
// type settings
@@ -398,11 +410,14 @@ class LAMConfig {
if (!in_array("loginMethod", $saved)) array_push($file_array, "\n\n# Login method.\n" . "loginMethod: " . $this->loginMethod . "\n");
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("lamProMailSubject", $saved)) array_push($file_array, "\n\n# Password mail subject\n" . "lamProMailSubject: " . $this->lamProMailSubject . "\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);
for ($i = 0; $i < sizeof($m_settings); $i++) {
if (!in_array($m_settings[$i], $mod_saved)) {
- array_push($file_array, "modules: " . $m_settings[$i] . ": " . implode("+::+", $this->moduleSettings[$m_settings[$i]]) . "\n");
+ array_push($file_array, "modules: " . $m_settings[$i] . ": " . implode(LAMConfig::LINE_SEPARATOR, $this->moduleSettings[$m_settings[$i]]) . "\n");
}
}
// check if all type settings were added
@@ -1003,6 +1018,65 @@ class LAMConfig {
public function setLoginSearchSuffix($loginSearchSuffix) {
$this->loginSearchSuffix = $loginSearchSuffix;
}
+
+ /**
+ * Returns the sender address for password reset mails.
+ *
+ * @return String mail address
+ */
+ public function getLamProMailFrom() {
+ return $this->lamProMailFrom;
+ }
+
+ /**
+ * Sets the sender address for password reset mails.
+ *
+ * @param String $lamProMailFrom mail address
+ * @return boolean true if address is valid
+ */
+ public function setLamProMailFrom($lamProMailFrom) {
+ $this->lamProMailFrom = $lamProMailFrom;
+ if (($lamProMailFrom != '') && !get_preg($lamProMailFrom, 'email')) {
+ return false;
+ }
+ return true;
+ }
+
+ /**
+ * Returns the subject for password reset mails.
+ *
+ * @return String subject
+ */
+ public function getLamProMailSubject() {
+ return $this->lamProMailSubject;
+ }
+
+ /**
+ * Sets the subject for password reset mails.
+ *
+ * @param String $lamProMailSubject subject
+ */
+ public function setLamProMailSubject($lamProMailSubject) {
+ $this->lamProMailSubject = $lamProMailSubject;
+ }
+
+ /**
+ * Returns the mail body for password reset mails.
+ *
+ * @return String body
+ */
+ public function getLamProMailText() {
+ return implode("\r\n", explode(LAMConfig::LINE_SEPARATOR, $this->lamProMailText));
+ }
+
+ /**
+ * Sets the mail body for password reset mails.
+ *
+ * @param String $lamProMailText body
+ */
+ public function setLamProMailText($lamProMailText) {
+ $this->lamProMailText = implode(LAMConfig::LINE_SEPARATOR, explode("\r\n", $lamProMailText));
+ }
}
diff --git a/lam/templates/config/confmain.php b/lam/templates/config/confmain.php
index 3c72d504..6f72318b 100644
--- a/lam/templates/config/confmain.php
+++ b/lam/templates/config/confmain.php
@@ -230,10 +230,10 @@ jQuery(document).ready(function() {