git push origin developMerge branch 'Devensys-develop-HiddenMailPasswordForgotten' into develop
This commit is contained in:
commit
bbdf408314
@ -10,7 +10,7 @@
|
||||
* Copyright (C) 2010-2014 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
|
||||
* Copyright (C) 2013 Alexandre Spangaro <alexandre.spangaro@gmail.com>
|
||||
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
|
||||
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
|
||||
* Copyright (C) 2014 Cédric GROSS <c.gross@kreiz-it.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
<?php
|
||||
/* Copyright (C) 2008-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
/* Copyright (C) 2008-2014 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2008-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2008 Raphael Bertrand (Resultic) <raphael.bertrand@resultic.fr>
|
||||
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
|
||||
@ -479,6 +479,50 @@ function clean_url($url,$http=1)
|
||||
else return $url;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Returns an email value with obfuscated parts.
|
||||
*
|
||||
* @param string $mail Email
|
||||
* @param string $replace Replacement character (defaul : *)
|
||||
* @param int $nbreplace Number of replacement character (default : 8)
|
||||
* @param int $nbdisplaymail Number of character unchanged (default: 4)
|
||||
* @param int $nbdisplaydomain Number of character unchanged of domain (default: 3)
|
||||
* @param bool $displaytld Display tld (default: true)
|
||||
* @return string Return email with hidden parts or '';
|
||||
*/
|
||||
function dolObfuscateEmail($mail, $replace="*", $nbreplace=8, $nbdisplaymail=4, $nbdisplaydomain=3, $displaytld=true)
|
||||
{
|
||||
if(!isValidEmail($mail))return '';
|
||||
$tab = explode('@', $mail);
|
||||
$tab2 = explode('.',$tab[1]);
|
||||
$string_replace = '';
|
||||
$mail_name = $tab[0];
|
||||
$mail_domaine = $tab2[0];
|
||||
$mail_tld = '';
|
||||
|
||||
for($i=1; $i < count($tab2) && $displaytld ;$i++)
|
||||
{
|
||||
$mail_tld .= '.'.$tab2[$i];
|
||||
}
|
||||
|
||||
for($i=0; $i < $nbreplace; $i++){
|
||||
$string_replace .= $replace;
|
||||
}
|
||||
|
||||
if(strlen($mail_name) > $nbdisplaymail){
|
||||
$mail_name = substr($mail_name, 0, $nbdisplaymail);
|
||||
}
|
||||
|
||||
if(strlen($mail_domaine) > $nbdisplaydomain){
|
||||
$mail_domaine = substr($mail_domaine, strlen($mail_domaine)-$nbdisplaydomain);
|
||||
}
|
||||
|
||||
return $mail_name . $string_replace . $mail_domaine . $mail_tld;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return lines of an html table from an array
|
||||
* Used by array2table function only
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
/* Copyright (C) 2007-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2008-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2008-2011 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2014 Teddy Andreotti <125155@supinfo.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -27,8 +28,8 @@ define("NOLOGIN",1); // This means this output page does not require to be logge
|
||||
require '../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/usergroups.lib.php';
|
||||
if (! empty($conf->ldap->enabled))
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/ldap.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
||||
if (! empty($conf->ldap->enabled)) require_once DOL_DOCUMENT_ROOT.'/core/class/ldap.class.php';
|
||||
|
||||
$langs->load("errors");
|
||||
$langs->load("users");
|
||||
@ -130,7 +131,8 @@ if ($action == 'buildnewpassword' && $username)
|
||||
// Success
|
||||
if ($edituser->send_password($user,$newpassword,1) > 0)
|
||||
{
|
||||
$message = '<div class="ok">'.$langs->trans("PasswordChangeRequestSent",$edituser->login,$edituser->email).'</div>';
|
||||
|
||||
$message = '<div class="ok">'.$langs->trans("PasswordChangeRequestSent",$edituser->login,dolObfuscateEmail($edituser->email)).'</div>';
|
||||
//$message.=$newpassword;
|
||||
$username='';
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user