diff --git a/htdocs/core/ajax/security.php b/htdocs/core/ajax/security.php index b01c952662e..2a836359e1c 100644 --- a/htdocs/core/ajax/security.php +++ b/htdocs/core/ajax/security.php @@ -36,7 +36,7 @@ if (!defined('NOREQUIREAJAX')) { if (!defined('NOREQUIRESOC')) { define('NOREQUIRESOC', '1'); } -// We need langs because the getRandomPassword may use user language to define some rules of pass generation +// We need langs because the getRandomPassword may use the user language to define some rules of pass generation /*if (!defined('NOREQUIRETRAN')) { define('NOREQUIRETRAN', '1'); }*/ diff --git a/htdocs/core/lib/security2.lib.php b/htdocs/core/lib/security2.lib.php index c68bb49d93b..b60054b9701 100644 --- a/htdocs/core/lib/security2.lib.php +++ b/htdocs/core/lib/security2.lib.php @@ -581,6 +581,9 @@ function dolJSToSetRandomPassword($htmlname, $htmlnameofbutton = 'generate_token token: \''.dol_escape_js(newToken()).'\' }, function(result) { + if ($("input#'.dol_escape_js($htmlname).'").attr("type") == "password") { + $("input#'.dol_escape_js($htmlname).'").attr("type", "text"); + } $("#'.dol_escape_js($htmlname).'").val(result); }); }); diff --git a/htdocs/projet/class/task.class.php b/htdocs/projet/class/task.class.php index eb2f0f35069..89a189a98c8 100644 --- a/htdocs/projet/class/task.class.php +++ b/htdocs/projet/class/task.class.php @@ -1821,7 +1821,6 @@ class Task extends CommonObjectLine } if (!$error) { - $timespent = new TimeSpent($this->db); $timespent->fetch($this->timespent_id); diff --git a/htdocs/public/users/view.php b/htdocs/public/users/view.php index 30b76404472..c62420c76d8 100644 --- a/htdocs/public/users/view.php +++ b/htdocs/public/users/view.php @@ -205,7 +205,7 @@ $arrayofjs = array(); $arrayofcss = array(); $replacemainarea = (empty($conf->dol_hide_leftmenu) ? '
' : '').'
'; -llxHeader($head, $object->getFullName($langs).' - '.$langs->trans("PublicVirtualCard"), '', '', 0, 0, '', '', '', 'onlinepaymentbody'.(GETPOST('mode')=='preview' ? ' scalepreview nopointervent' : ''), $replacemainarea, 1, 1); +llxHeader($head, $object->getFullName($langs).' - '.$langs->trans("PublicVirtualCard"), '', '', 0, 0, '', '', '', 'onlinepaymentbody'.(GETPOST('mode')=='preview' ? ' scalepreview cursorpointer virtualcardpreview' : ''), $replacemainarea, 1, 1); print ''."\n"; print '
'."\n"; @@ -463,6 +463,19 @@ print '
'; //print '
'; print '
'; +$fullexternaleurltovirtualcard = $object->getOnlineVirtualCardUrl('', 'external'); +$fullinternalurltovirtualcard = $object->getOnlineVirtualCardUrl('', 'internal'); + +print ''; + llxFooter('', 'public'); $db->close(); diff --git a/htdocs/user/card.php b/htdocs/user/card.php index 8db29a87449..dfd90b4dc0f 100644 --- a/htdocs/user/card.php +++ b/htdocs/user/card.php @@ -1046,13 +1046,13 @@ if ($action == 'create' || $action == 'adduserldap') { if (preg_match('/http/', $dolibarr_main_authentication)) { $valuetoshow .= ($valuetoshow ? ' + ' : '').$langs->trans("HTTPBasicPassword"); } - if (preg_match('/dolibarr/', $dolibarr_main_authentication)) { + if (preg_match('/dolibarr/', $dolibarr_main_authentication) || preg_match('/forceuser/', $dolibarr_main_authentication)) { if (!empty($ldap_pass)) { // For very old system comaptibilty. Now clear password can't be viewed from LDAP read $valuetoshow .= ($valuetoshow ? ' + ' : '').''; // Dolibarr password is preffiled with LDAP known password $valuetoshow .= preg_replace('/./i', '*', $ldap_pass); } else { // We do not use a field password but a field text to show new password to use. - $valuetoshow .= ($valuetoshow ? ' + '.$langs->trans("DolibarrPassword") : '').''; + $valuetoshow .= ($valuetoshow ? ' + '.$langs->trans("DolibarrPassword") : '').''; if (!empty($conf->use_javascript_ajax)) { $valuetoshow .= ' '.img_picto($langs->trans('Generate'), 'refresh', 'id="generate_password" class="linkobject"'); } @@ -1076,7 +1076,7 @@ if ($action == 'create' || $action == 'adduserldap') { //$generated_password = getRandomPassword(false); print ''.$langs->trans("ApiKey").''; print ''; - print ''; + print ''; if (!empty($conf->use_javascript_ajax)) { print ' '.img_picto($langs->trans('Generate'), 'refresh', 'id="generate_api_key" class="linkobject"'); } @@ -2423,14 +2423,16 @@ if ($action == 'create' || $action == 'adduserldap') { if (preg_match('/http/', $dolibarr_main_authentication)) { $valuetoshow .= ($valuetoshow ? (' '.$langs->trans("or").' ') : '').$form->textwithpicto($text, $langs->trans("DolibarrInHttpAuthenticationSoPasswordUseless", $dolibarr_main_authentication), 1, 'warning'); } - if (preg_match('/dolibarr/', $dolibarr_main_authentication)) { + if (preg_match('/dolibarr/', $dolibarr_main_authentication) || preg_match('/forceuser/', $dolibarr_main_authentication)) { if ($caneditpassword) { $valuetoshow .= ($valuetoshow ? (' '.$langs->trans("or").' ') : '').''; + if (!empty($conf->use_javascript_ajax)) { + $valuetoshow .= ' '.img_picto((getDolGlobalString('USER_PASSWORD_GENERATED') === 'none' ? $langs->trans('NoPasswordGenerationRuleConfigured') : $langs->trans('Generate')), 'refresh', 'id="generate_password" class="'.(getDolGlobalString('USER_PASSWORD_GENERATED') === 'none' ? ' opacitymedium' : ' linkobject').'"'); + } } else { $valuetoshow .= ($valuetoshow ? (' '.$langs->trans("or").' ') : '').preg_replace('/./i', '*', $object->pass); } } - // Other form for user password $parameters = array('valuetoshow' => $valuetoshow, 'caneditpassword' => $caneditpassword); $reshook = $hookmanager->executeHooks('printUserPasswordField', $parameters, $object, $action); // Note that $action and $object may have been modified by hook diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index fac112bd7b4..1186cf7a914 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -3869,9 +3869,10 @@ class User extends CommonObject * Return string with full Url to virtual card * * @param string $mode Mode for link + * @param string $typeofurl 'external' or 'internal' * @return string Url string link */ - public function getOnlineVirtualCardUrl($mode = '') + public function getOnlineVirtualCardUrl($mode = '', $typeofurl = 'external') { global $dolibarr_main_instance_unique_id, $dolibarr_main_url_root; global $conf; @@ -3887,6 +3888,10 @@ class User extends CommonObject $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 + if ($typeofurl == 'internal') { + $urlwithroot = DOL_URL_ROOT; + } + return $urlwithroot.'/public/users/view.php?id='.$this->id.'&securekey='.$encodedsecurekey.$entity_qr.($mode ? '&mode='.urlencode($mode) : ''); } diff --git a/htdocs/user/virtualcard.php b/htdocs/user/virtualcard.php index 252ae3aca80..55d63c3d40a 100644 --- a/htdocs/user/virtualcard.php +++ b/htdocs/user/virtualcard.php @@ -165,7 +165,8 @@ if (getDolUserInt('USER_ENABLE_PUBLIC', 0, $object)) { //print $langs->trans('FollowingLinksArePublic').'
'; print img_picto('', 'globe').' '.$langs->trans('PublicVirtualCardUrl').'
'; - $fullexternaleurltovirtualcard = $object->getOnlineVirtualCardUrl(); + $fullexternaleurltovirtualcard = $object->getOnlineVirtualCardUrl('', 'external'); + $fullinternalurltovirtualcard = $object->getOnlineVirtualCardUrl('', 'internal'); print '