diff --git a/admin_templates.php b/admin_templates.php
index 1ff249d3..4ebbb4ad 100644
--- a/admin_templates.php
+++ b/admin_templates.php
@@ -55,7 +55,8 @@ $available_templates = array(
'new_reply_ticket_by_customer',
'new_reply_ticket_by_staff',
'new_database_by_customer',
- 'new_ftpaccount_by_customer'
+ 'new_ftpaccount_by_customer',
+ 'password_reset'
);
$file_templates = array(
'index_html'
diff --git a/index.php b/index.php
index 425e0037..fc145417 100644
--- a/index.php
+++ b/index.php
@@ -221,14 +221,14 @@ if($action == 'forgotpwd')
{
$loginname = validate($_POST['loginname'], 'loginname');
$email = validateEmail($_POST['loginemail'], 'email');
- $sql = "SELECT `customerid`, `firstname`, `name`, `email`, `loginname` FROM `" . TABLE_PANEL_CUSTOMERS . "`
+ $sql = "SELECT `adminid`, `customerid`, `firstname`, `name`, `company`, `email`, `loginname`, `def_language` FROM `" . TABLE_PANEL_CUSTOMERS . "`
WHERE `loginname`='" . $db->escape($loginname) . "'
AND `email`='" . $db->escape($email) . "'";
$result = $db->query($sql);
if($db->num_rows() == 0)
{
- $sql = "SELECT `adminid`, `name`, `email`, `loginname` FROM `" . TABLE_PANEL_ADMINS . "`
+ $sql = "SELECT `adminid`, `name`, `email`, `loginname`, `def_language` FROM `" . TABLE_PANEL_ADMINS . "`
WHERE `loginname`='" . $db->escape($loginname) . "'
AND `email`='" . $db->escape($email) . "'";
$result = $db->query($sql);
@@ -280,13 +280,26 @@ if($action == 'forgotpwd')
$rstlog = FroxlorLogger::getInstanceOf(array('loginname' => 'password_reset'), $db, $settings);
$rstlog->logAction(USR_ACTION, LOG_WARNING, "Password for user '" . $user['loginname'] . "' has been reset!");
+
+ $replace_arr = array(
+ 'SALUTATION' => getCorrectUserSalutation($user),
+ 'USERNAME' => $user['loginname'],
+ 'PASSWORD' => $password
+ );
+
$body = strtr($lng['pwdreminder']['body'], array('%s' => $user['firstname'] . ' ' . $user['name'], '%p' => $password));
+
+ $def_language = ($user['def_language'] != '') ? $user['def_language'] : $settings['panel']['standardlanguage'];
+ $result = $db->query_first('SELECT `value` FROM `' . TABLE_PANEL_TEMPLATES . '` WHERE `adminid`=\'' . (int)$user['adminid'] . '\' AND `language`=\'' . $db->escape($def_language) . '\' AND `templategroup`=\'mails\' AND `varname`=\'password_reset_subject\'');
+ $mail_subject = html_entity_decode(replace_variables((($result['value'] != '') ? $result['value'] : $lng['pwdreminder']['subject']), $replace_arr));
+ $result = $db->query_first('SELECT `value` FROM `' . TABLE_PANEL_TEMPLATES . '` WHERE `adminid`=\'' . (int)$user['adminid'] . '\' AND `language`=\'' . $db->escape($def_language) . '\' AND `templategroup`=\'mails\' AND `varname`=\'password_reset_mailbody\'');
+ $mail_body = html_entity_decode(replace_variables((($result['value'] != '') ? $result['value'] : $body), $replace_arr));
$_mailerror = false;
try {
- $mail->Subject = $lng['pwdreminder']['subject'];
- $mail->AltBody = $body;
- $mail->MsgHTML(str_replace("\\n", "
", $body));
+ $mail->Subject = $mail_subject;
+ $mail->AltBody = $mail_body;
+ $mail->MsgHTML(str_replace("\\n", "
", $mail_body));
$mail->AddAddress($user['email'], $user['firstname'] . ' ' . $user['name']);
$mail->Send();
} catch(phpmailerException $e) {
diff --git a/lng/english.lng.php b/lng/english.lng.php
index af1b60e3..e1ba8842 100644
--- a/lng/english.lng.php
+++ b/lng/english.lng.php
@@ -320,7 +320,7 @@ $lng['admin']['templates']['mailbody'] = 'Mail body';
$lng['admin']['templates']['createcustomer'] = 'Welcome mail for new customers';
$lng['admin']['templates']['pop_success'] = 'Welcome mail for new email accounts';
$lng['admin']['templates']['template_replace_vars'] = 'Variables to be replaced in the template:';
-$lng['admin']['templates']['SALUTATION'] = 'Replaced with a correct salutation';
+$lng['admin']['templates']['SALUTATION'] = 'Replaced with a correct salutation (name or company)';
$lng['admin']['templates']['FIRSTNAME'] = 'Replaced with the customers firstname.';
$lng['admin']['templates']['NAME'] = 'Replaced with the customers name.';
$lng['admin']['templates']['COMPANY'] = 'Replaces with the customers company name';
@@ -1495,5 +1495,6 @@ $lng['serversettings']['awstats_awstatspath'] = 'Path to AWStats \'awstats.pl\''
// ADDED IN FROXLOR 0.9.12-svn6
$lng['extras']['htpasswdauthname'] = 'Authentication reason (AuthName)';
$lng['extras']['directoryprotection_edit'] = 'edit directory protection';
+$lng['admin']['templates']['forgotpwd'] = 'Notification-mails for password-reset';
?>
diff --git a/lng/german.lng.php b/lng/german.lng.php
index 5bce2f81..2c925ddb 100644
--- a/lng/german.lng.php
+++ b/lng/german.lng.php
@@ -1478,5 +1478,6 @@ $lng['serversettings']['awstats_awstatspath'] = 'Pfad zu AWStats \'awstats.pl\''
// ADDED IN FROXLOR 0.9.12-svn6
$lng['extras']['htpasswdauthname'] = 'Authentifizierungs-Grund (AuthName)';
$lng['extras']['directoryprotection_edit'] = 'Verzeichnisschutz bearbeiten';
+$lng['admin']['templates']['forgotpwd'] = 'Benachrichtigungs-Mails bei Zurücksetzen des Passworts';
?>
diff --git a/templates/admin/templates/templates_add_2.tpl b/templates/admin/templates/templates_add_2.tpl
index 221574af..e2f527c4 100644
--- a/templates/admin/templates/templates_add_2.tpl
+++ b/templates/admin/templates/templates_add_2.tpl
@@ -80,6 +80,21 @@ $header