From c65b5a7a2175deea15422823fb39ce532303d3c9 Mon Sep 17 00:00:00 2001 From: Benjamin Renard Date: Thu, 18 Nov 2010 15:37:50 +0100 Subject: [PATCH] LSformElement_password : Change mail generation to support attributes in the LSformat of the mail --- .../conf/LSobjects/config.LSobjects.LSpeople.php | 2 +- .../includes/class/class.LSformElement_password.php | 11 +++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/public_html/conf/LSobjects/config.LSobjects.LSpeople.php b/public_html/conf/LSobjects/config.LSobjects.LSpeople.php index bd314e3b..b18d523d 100644 --- a/public_html/conf/LSobjects/config.LSobjects.LSpeople.php +++ b/public_html/conf/LSobjects/config.LSobjects.LSpeople.php @@ -498,7 +498,7 @@ $GLOBALS['LSobjects']['LSpeople'] = array ( 'send' => 1, 'ask' => 1, 'subject' => "LSexample : Your new credentials.", - 'msg' => "Your password has been changed.\nNew password : %{mdp}", + 'msg' => "Your password has been changed.\nLogin : %{uid}\nNew password : %{password}", 'mail_attr' => 'mail' ) ), diff --git a/public_html/includes/class/class.LSformElement_password.php b/public_html/includes/class/class.LSformElement_password.php index b59d9d58..460c0c50 100644 --- a/public_html/includes/class/class.LSformElement_password.php +++ b/public_html/includes/class/class.LSformElement_password.php @@ -79,7 +79,7 @@ class LSformElement_password extends LSformElement { LSdebug ('send by config'); } if ($this -> sendMail && LSsession :: loadLSaddon('mail')) { - $msg = getFData($this -> params['html_options']['mail']['msg'],$return[$this -> name][0]); + $msg = $this -> params['html_options']['mail']['msg']; $subject = $this -> params['html_options']['mail']['subject']; if (isset($_POST['LSformElement_password_'.$this -> name.'_msg'])) { $msgInfos = json_decode($_POST['LSformElement_password_'.$this -> name.'_msg']); @@ -87,7 +87,7 @@ class LSformElement_password extends LSformElement { $subject = $msgInfos -> subject; } if ($msgInfos -> msg) { - $msg = getFData($msgInfos -> msg,$return[$this -> name][0]); + $msg = $msgInfos -> msg; } if ($msgInfos -> mail) { $mail = $msgInfos -> mail; @@ -96,7 +96,8 @@ class LSformElement_password extends LSformElement { $this -> sendMail = array ( 'subject' => $subject, 'msg' => $msg, - 'mail' => $mail + 'mail' => $mail, + 'pwd' => $return[$this -> name][0] ); $this -> attr_html -> attribute -> addObjectEvent('after_modify',$this,'send'); } @@ -181,10 +182,12 @@ class LSformElement_password extends LSformElement { } if (checkEmail($mail,NULL,true)) { + $this -> attr_html -> attribute -> ldapObject -> registerOtherValue('password',$this -> sendMail['pwd']); + $msg = $this -> attr_html -> attribute -> ldapObject -> getFData($this -> sendMail['msg']); if (sendMail( $mail, $this -> sendMail['subject'], - $this -> sendMail['msg'] + $msg )) { LSsession :: addInfo(_('Notice mail sent.')); }