From 7d1292d8386f21f017e9444e07d17f1ad174ed67 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Fri, 13 Apr 2018 09:05:17 +0200 Subject: [PATCH 1/3] NEW add "printUserPasswordField" hooks --- htdocs/user/card.php | 29 +++++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-) diff --git a/htdocs/user/card.php b/htdocs/user/card.php index f9a69d37baa..beefbf83a3c 100644 --- a/htdocs/user/card.php +++ b/htdocs/user/card.php @@ -818,6 +818,13 @@ if ($action == 'create' || $action == 'adduserldap') $valuetoshow.= ($valuetoshow?', ':'').''; } } + + // Other form for add user to group + $parameters=array('valuetoshow' => $valuetoshow); + $reshook=$hookmanager->executeHooks('printUserPasswordField',$parameters,$object,$action); // Note that $action and $object may have been modified by hook + if ($reshook > 0) $valuetoshow=$hookmanager->resPrint; // to replace + else $valuetoshow.=$hookmanager->resPrint; // to add + print $valuetoshow; print ''; @@ -1363,6 +1370,13 @@ else else $valuetoshow.= ($valuetoshow?(' '.$langs->trans("or").' '):'').$langs->trans("Hidden"); } } + + // Other form for add user to group + $parameters=array('valuetoshow' => $valuetoshow); + $reshook=$hookmanager->executeHooks('printUserPasswordField',$parameters,$object,$action); // Note that $action and $object may have been modified by hook + if ($reshook > 0) $valuetoshow=$hookmanager->resPrint; // to replace + else $valuetoshow.=$hookmanager->resPrint; // to add + print $valuetoshow; print ""; print ''."\n"; @@ -1923,6 +1937,13 @@ else $valuetoshow.=($valuetoshow?(' '.$langs->trans("or").' '):'').preg_replace('/./i','*',$object->pass); } } + + // Other form for add user to group + $parameters=array('valuetoshow' => $valuetoshow); + $reshook=$hookmanager->executeHooks('printUserPasswordField',$parameters,$object,$action); // Note that $action and $object may have been modified by hook + if ($reshook > 0) $valuetoshow=$hookmanager->resPrint; // to replace + else $valuetoshow.=$hookmanager->resPrint; // to add + print $valuetoshow; print "\n"; @@ -2033,7 +2054,7 @@ else else { $type=0; - if ($object->contact_id) $type=$object->contact_id; + if ($object->contactid) $type=$object->contactid; print $form->selectcontacts(0,$type,'contactid',2,'','',1,'',false,1); if ($object->ldap_sid) print ' ('.$langs->trans("DomainUser").')'; } @@ -2203,12 +2224,12 @@ else print ''; if ($caneditfield) { - print ''; + print ''; } else { - print ''; - print $object->accountancy_code; + print ''; + print $object->accountancy_code; } print ''; print ""; From 7c3f0be83d4c5fa5609c9b787301f948957cc815 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Fri, 13 Apr 2018 09:09:26 +0200 Subject: [PATCH 2/3] Fix: missing parameters --- htdocs/user/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/user/card.php b/htdocs/user/card.php index beefbf83a3c..ecfb5de2436 100644 --- a/htdocs/user/card.php +++ b/htdocs/user/card.php @@ -820,7 +820,7 @@ if ($action == 'create' || $action == 'adduserldap') } // Other form for add user to group - $parameters=array('valuetoshow' => $valuetoshow); + $parameters=array('valuetoshow' => $valuetoshow, 'password' => $password); $reshook=$hookmanager->executeHooks('printUserPasswordField',$parameters,$object,$action); // Note that $action and $object may have been modified by hook if ($reshook > 0) $valuetoshow=$hookmanager->resPrint; // to replace else $valuetoshow.=$hookmanager->resPrint; // to add From a317c54b66522267b5362bc447de514ac03991b5 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Fri, 13 Apr 2018 09:39:02 +0200 Subject: [PATCH 3/3] Fix: missing right parameter --- htdocs/user/card.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/user/card.php b/htdocs/user/card.php index ecfb5de2436..15c8df0d2b9 100644 --- a/htdocs/user/card.php +++ b/htdocs/user/card.php @@ -819,7 +819,7 @@ if ($action == 'create' || $action == 'adduserldap') } } - // Other form for add user to group + // Other form for user password $parameters=array('valuetoshow' => $valuetoshow, 'password' => $password); $reshook=$hookmanager->executeHooks('printUserPasswordField',$parameters,$object,$action); // Note that $action and $object may have been modified by hook if ($reshook > 0) $valuetoshow=$hookmanager->resPrint; // to replace @@ -828,7 +828,7 @@ if ($action == 'create' || $action == 'adduserldap') print $valuetoshow; print ''; - if(! empty($conf->api->enabled)) + if (! empty($conf->api->enabled)) { // API key $generated_api_key = ''; @@ -1371,7 +1371,7 @@ else } } - // Other form for add user to group + // Other form for user password $parameters=array('valuetoshow' => $valuetoshow); $reshook=$hookmanager->executeHooks('printUserPasswordField',$parameters,$object,$action); // Note that $action and $object may have been modified by hook if ($reshook > 0) $valuetoshow=$hookmanager->resPrint; // to replace @@ -1938,8 +1938,8 @@ else } } - // Other form for add user to group - $parameters=array('valuetoshow' => $valuetoshow); + // 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 if ($reshook > 0) $valuetoshow=$hookmanager->resPrint; // to replace else $valuetoshow.=$hookmanager->resPrint; // to add