New: Translate the email to change password.

This commit is contained in:
Laurent Destailleur 2013-08-25 06:53:59 +02:00
parent 4ec85e6722
commit 4eb37abed9
5 changed files with 35 additions and 16 deletions

View File

@ -55,6 +55,7 @@ For users:
For translators:
- Qual: Normalized sort order of all languages files with english reference files.
- New: Add language code files for South Africa.
- New: Translate the email to change password.
For developers:
- New: DolGraph can build graph with three lines.

View File

@ -174,6 +174,12 @@ StartUpload=Start upload
CancelUpload=Cancel upload
FileIsTooBig=Files is too big
PleaseBePatient=Please be patient...
RequestToResetPasswordReceived=A request to change your Dolibarr password has been received
NewKeyIs=This is your new keys to login
NewKeyWillBe=Your new key to login to software will be
ClickHereToGoTo=Click here to go to %s
YouMustClickToChange=You must however first click on the following link to validate this password change
ForgetIfNothing=If you didn't request this change, just forget this email. Your credentials are kept safe.
##### Calendar common #####
AddCalendarEntry=Add entry in calendar %s

View File

@ -116,4 +116,5 @@ NbOfUsers=Nb of users
DontDowngradeSuperAdmin=Only a superadmin can downgrade a superadmin
HierarchicalResponsible=Hierarchical responsible
HierarchicView=Hierarchical view
UseTypeFieldToChange=Use field Type to change
UseTypeFieldToChange=Use field Type to change

View File

@ -174,6 +174,12 @@ StartUpload=Transférer
CancelUpload=Annuler le transfert
FileIsTooBig=Le fichier est trop volumineux
PleaseBePatient=Merci de patienter quelques instants…
RequestToResetPasswordReceived=Une demande de modification de mot de passe a été reçue
NewKeyIs=Voici vos nouveaux identifiants pour vous connecter
NewKeyWillBe=Vos nouveaux identifiants pour vous connecter à l'application seront
ClickHereToGoTo=Cliquez ici pour aller sur %s
YouMustClickToChange=Vous devez toutefois auparavant cliquer sur le lien suivant, afin de valider ce changement de mot de passe
ForgetIfNothing=Si vous n'êtes pas à l'origine de la demande, ignorez simplement ce mail. Votre accès reste sécurisé.
##### Calendar common #####
AddCalendarEntry=Ajouter entrée dans le calendrier %s

View File

@ -96,7 +96,7 @@ class User extends CommonObject
var $users; // To store all tree of users hierarchy
var $parentof; // To store an array of all parents for all ids.
var $accountancy_code; // Accountancy code in prevision of the complete accountancy module
@ -1457,7 +1457,6 @@ class User extends CommonObject
require_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php';
$subject = $langs->trans("SubjectNewPassword");
$msgishtml=0;
// Define $msg
@ -1474,35 +1473,41 @@ class User extends CommonObject
$outputlangs=$langs;
}
$outputlangs->load("main");
$outputlangs->load("errors");
$outputlangs->load("users");
$outputlangs->load("other");
$subject = $outputlangs->trans("SubjectNewPassword");
// Define $urlwithroot
//$urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT,'/').'$/i','',trim($dolibarr_main_url_root));
//$urlwithroot=$urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file
$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current
// TODO Use outputlangs to translate messages
if (! $changelater)
{
$mesg.= "A request to change your Dolibarr password has been received.\n";
$mesg.= "This is your new keys to login:\n\n";
$mesg.= $langs->trans("Login")." : $this->login\n";
$mesg.= $langs->trans("Password")." : $password\n\n";
$mesg.= $outputlangs->transnoentitiesnoconv("RequestToResetPasswordReceived").".\n";
$mesg.= $outputlangs->transnoentitiesnoconv("NewKeyIs")." :\n\n";
$mesg.= $outputlangs->transnoentitiesnoconv("Login")." = ".$this->login."\n";
$mesg.= $outputlangs->transnoentitiesnoconv("Password")." = ".$password."\n\n";
$mesg.= "\n";
$url = $urlwithroot;
$mesg.= 'Click here to go to Dolibarr: '.$url."\n\n";
$mesg.= $outputlangs->transnoentitiesnoconv("ClickHereToGoTo", $conf->global->MAIN_APPLICATION_TITLE).': '.$url."\n\n";
$mesg.= "--\n";
$mesg.= $user->getFullName($langs); // Username that make then sending
$mesg.= $user->getFullName($outputlangs); // Username that make then sending
}
else
{
$mesg.= "A request to change your Dolibarr password has been received.\n";
$mesg.= "Your new key to login will be:\n\n";
$mesg.= $langs->trans("Login")." : $this->login\n";
$mesg.= $langs->trans("Password")." : $password\n\n";
$mesg.= $outputlangs->transnoentitiesnoconv("RequestToResetPasswordReceived")."\n";
$mesg.= $outputlangs->transnoentitiesnoconv("NewKeyWillBe")." :\n\n";
$mesg.= $outputlangs->transnoentitiesnoconv("Login")." = ".$this->login."\n";
$mesg.= $outputlangs->transnoentitiesnoconv("Password")." = ".$password."\n\n";
$mesg.= "\n";
$mesg.= "You must click on the folowing link to validate its change.\n";
$mesg.= $outputlangs->transnoentitiesnoconv("YouMustClickToChange")." :\n";
$url = $urlwithroot.'/user/passwordforgotten.php?action=validatenewpassword&username='.$this->login."&passwordmd5=".dol_hash($password);
$mesg.= $url."\n\n";
$mesg.= "If you didn't ask anything, just forget this email\n\n";
$mesg.= $outputlangs->transnoentitiesnoconv("ForgetIfNothing")."\n\n";
dol_syslog(get_class($this)."::send_password url=".$url);
}
$mailfile = new CMailFile(