Merge pull request #8583 from hregis/develop_ldap

NEW add "printUserPasswordField" hooks
This commit is contained in:
Laurent Destailleur 2018-04-13 23:36:20 +02:00 committed by GitHub
commit f84b74f4cc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -818,6 +818,13 @@ if ($action == 'create' || $action == 'adduserldap')
$valuetoshow.= ($valuetoshow?', ':'').'<input size="30" maxsize="32" type="text" name="password" value="'.$password.'" autocomplete="new-password">'; $valuetoshow.= ($valuetoshow?', ':'').'<input size="30" maxsize="32" type="text" name="password" value="'.$password.'" autocomplete="new-password">';
} }
} }
// 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
else $valuetoshow.=$hookmanager->resPrint; // to add
print $valuetoshow; print $valuetoshow;
print '</td></tr>'; print '</td></tr>';
@ -1363,6 +1370,13 @@ else
else $valuetoshow.= ($valuetoshow?(' '.$langs->trans("or").' '):'').$langs->trans("Hidden"); else $valuetoshow.= ($valuetoshow?(' '.$langs->trans("or").' '):'').$langs->trans("Hidden");
} }
} }
// 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
else $valuetoshow.=$hookmanager->resPrint; // to add
print $valuetoshow; print $valuetoshow;
print "</td>"; print "</td>";
print '</tr>'."\n"; print '</tr>'."\n";
@ -1923,6 +1937,13 @@ else
$valuetoshow.=($valuetoshow?(' '.$langs->trans("or").' '):'').preg_replace('/./i','*',$object->pass); $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
if ($reshook > 0) $valuetoshow=$hookmanager->resPrint; // to replace
else $valuetoshow.=$hookmanager->resPrint; // to add
print $valuetoshow; print $valuetoshow;
print "</td></tr>\n"; print "</td></tr>\n";
@ -2033,7 +2054,7 @@ else
else else
{ {
$type=0; $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); print $form->selectcontacts(0,$type,'contactid',2,'','',1,'',false,1);
if ($object->ldap_sid) print ' ('.$langs->trans("DomainUser").')'; if ($object->ldap_sid) print ' ('.$langs->trans("DomainUser").')';
} }