|
|
|
|
@ -839,54 +839,6 @@ if ($action == 'create' || $action == 'adduserldap') {
|
|
|
|
|
}
|
|
|
|
|
$password = (GETPOSTISSET('password') ?GETPOST('password') : $generated_password);
|
|
|
|
|
|
|
|
|
|
// Password
|
|
|
|
|
print '<tr><td class="fieldrequired">'.$langs->trans("Password").'</td>';
|
|
|
|
|
print '<td>';
|
|
|
|
|
$valuetoshow = '';
|
|
|
|
|
if (preg_match('/ldap/', $dolibarr_main_authentication)) {
|
|
|
|
|
$valuetoshow .= ($valuetoshow ? ', ' : '').$langs->trans("PasswordOfUserInLDAP");
|
|
|
|
|
}
|
|
|
|
|
if (preg_match('/http/', $dolibarr_main_authentication)) {
|
|
|
|
|
$valuetoshow .= ($valuetoshow ? ', ' : '').$langs->trans("HTTPBasicPassword");
|
|
|
|
|
}
|
|
|
|
|
if (preg_match('/dolibarr/', $dolibarr_main_authentication)) {
|
|
|
|
|
if (!empty($ldap_pass)) { // For very old system comaptibilty. Now clear password can't be viewed from LDAP read
|
|
|
|
|
$valuetoshow .= ($valuetoshow ? ', ' : '').'<input type="hidden" name="password" value="'.$ldap_pass.'">'; // 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 ? ', ' : '').'<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 '</td></tr>';
|
|
|
|
|
|
|
|
|
|
if (!empty($conf->api->enabled)) {
|
|
|
|
|
// API key
|
|
|
|
|
//$generated_password = getRandomPassword(false);
|
|
|
|
|
print '<tr><td>'.$langs->trans("ApiKey").'</td>';
|
|
|
|
|
print '<td>';
|
|
|
|
|
print '<input size="30" maxsize="32" type="text" id="api_key" name="api_key" value="'.GETPOST('api_key', 'alphanohtml').'" autocomplete="off">';
|
|
|
|
|
if (!empty($conf->use_javascript_ajax)) {
|
|
|
|
|
print ' '.img_picto($langs->trans('Generate'), 'refresh', 'id="generate_api_key" class="linkobject"');
|
|
|
|
|
}
|
|
|
|
|
print '</td></tr>';
|
|
|
|
|
} else {
|
|
|
|
|
// PARTIAL WORKAROUND
|
|
|
|
|
$generated_fake_api_key = getRandomPassword(false);
|
|
|
|
|
print '<input type="hidden" name="api_key" value="'.$generated_fake_api_key.'">';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Administrator
|
|
|
|
|
if (!empty($user->admin)) {
|
|
|
|
|
print '<tr><td>'.$langs->trans("Administrator").'</td>';
|
|
|
|
|
@ -936,10 +888,11 @@ if ($action == 'create' || $action == 'adduserldap') {
|
|
|
|
|
print '</td></tr>';
|
|
|
|
|
|
|
|
|
|
// Employee
|
|
|
|
|
$defaultemployee = 1;
|
|
|
|
|
$defaultemployee = '1';
|
|
|
|
|
print '<tr>';
|
|
|
|
|
print '<td>'.$langs->trans('Employee').'</td><td>';
|
|
|
|
|
print $form->selectyesno("employee", (GETPOST('employee') != '' ?GETPOST('employee') : $defaultemployee), 1);
|
|
|
|
|
print '<input type="checkbox" name="employee" value="1"'.(GETPOST('employee') == '1' ? ' checked="checked"' : ($defaultemployee ? ' checked="checked"' : '')).'>';
|
|
|
|
|
//print $form->selectyesno("employee", (GETPOST('employee') != '' ?GETPOST('employee') : $defaultemployee), 1);
|
|
|
|
|
print '</td></tr>';
|
|
|
|
|
|
|
|
|
|
// Hierarchy
|
|
|
|
|
@ -979,6 +932,70 @@ if ($action == 'create' || $action == 'adduserldap') {
|
|
|
|
|
print $form->textwithpicto($langs->trans("Internal"), $langs->trans("InternalExternalDesc"), 1, 'help', '', 0, 2);
|
|
|
|
|
print '</td></tr>';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
print '</table><hr><table class="border centpercent">';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Date validity
|
|
|
|
|
print '<tr><td class="titlefieldcreate">'.$langs->trans("RangeOfLoginValidity").'</td>';
|
|
|
|
|
print '<td>';
|
|
|
|
|
print $form->selectDate($datestartvalidity, 'datestartvalidity', 0, 0, 1, 'formdatestartvalidity', 1, 1);
|
|
|
|
|
|
|
|
|
|
print ' ';
|
|
|
|
|
|
|
|
|
|
print $form->selectDate($dateendvalidity, 'dateendvalidity', 0, 0, 1, 'formdateendvalidity', 1, 0);
|
|
|
|
|
print '</td>';
|
|
|
|
|
print "</tr>\n";
|
|
|
|
|
|
|
|
|
|
// Password
|
|
|
|
|
print '<tr><td class="fieldrequired">'.$langs->trans("Password").'</td>';
|
|
|
|
|
print '<td>';
|
|
|
|
|
$valuetoshow = '';
|
|
|
|
|
if (preg_match('/ldap/', $dolibarr_main_authentication)) {
|
|
|
|
|
$valuetoshow .= ($valuetoshow ? ', ' : '').$langs->trans("PasswordOfUserInLDAP");
|
|
|
|
|
}
|
|
|
|
|
if (preg_match('/http/', $dolibarr_main_authentication)) {
|
|
|
|
|
$valuetoshow .= ($valuetoshow ? ', ' : '').$langs->trans("HTTPBasicPassword");
|
|
|
|
|
}
|
|
|
|
|
if (preg_match('/dolibarr/', $dolibarr_main_authentication)) {
|
|
|
|
|
if (!empty($ldap_pass)) { // For very old system comaptibilty. Now clear password can't be viewed from LDAP read
|
|
|
|
|
$valuetoshow .= ($valuetoshow ? ', ' : '').'<input type="hidden" name="password" value="'.$ldap_pass.'">'; // 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 ? ', ' : '').'<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 '</td></tr>';
|
|
|
|
|
|
|
|
|
|
if (!empty($conf->api->enabled)) {
|
|
|
|
|
// API key
|
|
|
|
|
//$generated_password = getRandomPassword(false);
|
|
|
|
|
print '<tr><td>'.$langs->trans("ApiKey").'</td>';
|
|
|
|
|
print '<td>';
|
|
|
|
|
print '<input class="minwidth300" maxsize="32" type="text" id="api_key" name="api_key" value="'.GETPOST('api_key', 'alphanohtml').'" autocomplete="off">';
|
|
|
|
|
if (!empty($conf->use_javascript_ajax)) {
|
|
|
|
|
print ' '.img_picto($langs->trans('Generate'), 'refresh', 'id="generate_api_key" class="linkobject"');
|
|
|
|
|
}
|
|
|
|
|
print '</td></tr>';
|
|
|
|
|
} else {
|
|
|
|
|
// PARTIAL WORKAROUND
|
|
|
|
|
$generated_fake_api_key = getRandomPassword(false);
|
|
|
|
|
print '<input type="hidden" name="api_key" value="'.$generated_fake_api_key.'">';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
print '</table><hr><table class="border centpercent">';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -1223,17 +1240,6 @@ if ($action == 'create' || $action == 'adduserldap') {
|
|
|
|
|
print '</td>';
|
|
|
|
|
print "</tr>\n";
|
|
|
|
|
|
|
|
|
|
// Date validity
|
|
|
|
|
print '<tr><td>'.$langs->trans("RangeOfLoginValidity").'</td>';
|
|
|
|
|
print '<td>';
|
|
|
|
|
print $form->selectDate($datestartvalidity, 'datestartvalidity', 0, 0, 1, 'formdatestartvalidity', 1, 1);
|
|
|
|
|
|
|
|
|
|
print ' - ';
|
|
|
|
|
|
|
|
|
|
print $form->selectDate($dateendvalidity, 'dateendvalidity', 0, 0, 1, 'formdateendvalidity', 1, 0);
|
|
|
|
|
print '</td>';
|
|
|
|
|
print "</tr>\n";
|
|
|
|
|
|
|
|
|
|
// Date birth
|
|
|
|
|
print '<tr><td>'.$langs->trans("DateOfBirth").'</td>';
|
|
|
|
|
print '<td>';
|
|
|
|
|
@ -1371,7 +1377,7 @@ if ($action == 'create' || $action == 'adduserldap') {
|
|
|
|
|
print '<table class="border tableforfield" width="100%">';
|
|
|
|
|
|
|
|
|
|
// Login
|
|
|
|
|
print '<tr><td class="titlefield">'.$langs->trans("Login").'</td>';
|
|
|
|
|
print '<tr><td class="titlefieldmiddle">'.$langs->trans("Login").'</td>';
|
|
|
|
|
if (!empty($object->ldap_sid) && $object->statut == 0) {
|
|
|
|
|
print '<td class="error">'.$langs->trans("LoginAccountDisableInDolibarr").'</td>';
|
|
|
|
|
} else {
|
|
|
|
|
@ -1379,72 +1385,6 @@ if ($action == 'create' || $action == 'adduserldap') {
|
|
|
|
|
}
|
|
|
|
|
print '</tr>'."\n";
|
|
|
|
|
|
|
|
|
|
// Password
|
|
|
|
|
print '<tr><td>'.$langs->trans("Password").'</td>';
|
|
|
|
|
|
|
|
|
|
print '<td class="wordbreak">';
|
|
|
|
|
$valuetoshow = '';
|
|
|
|
|
if (preg_match('/ldap/', $dolibarr_main_authentication)) {
|
|
|
|
|
if (!empty($object->ldap_sid)) {
|
|
|
|
|
if ($passDoNotExpire) {
|
|
|
|
|
$valuetoshow .= ($valuetoshow ? (' '.$langs->trans("or").' ') : '').$langs->trans("LdapUacf_".$statutUACF);
|
|
|
|
|
} elseif ($userChangePassNextLogon) {
|
|
|
|
|
$valuetoshow .= ($valuetoshow ? (' '.$langs->trans("or").' ') : '').'<span class="warning">'.$langs->trans("UserMustChangePassNextLogon", $ldap->domainFQDN).'</span>';
|
|
|
|
|
} elseif ($userDisabled) {
|
|
|
|
|
$valuetoshow .= ($valuetoshow ? (' '.$langs->trans("or").' ') : '').'<span class="warning">'.$langs->trans("LdapUacf_".$statutUACF, $ldap->domainFQDN).'</span>';
|
|
|
|
|
} else {
|
|
|
|
|
$valuetoshow .= ($valuetoshow ? (' '.$langs->trans("or").' ') : '').$langs->trans("PasswordOfUserInLDAP");
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
$valuetoshow .= ($valuetoshow ? (' '.$langs->trans("or").' ') : '').$langs->trans("PasswordOfUserInLDAP");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (preg_match('/http/', $dolibarr_main_authentication)) {
|
|
|
|
|
$valuetoshow .= ($valuetoshow ? (' '.$langs->trans("or").' ') : '').$langs->trans("HTTPBasicPassword");
|
|
|
|
|
}
|
|
|
|
|
if (preg_match('/dolibarr/', $dolibarr_main_authentication)) {
|
|
|
|
|
if ($object->pass) {
|
|
|
|
|
$valuetoshow .= ($valuetoshow ? (' '.$langs->trans("or").' ') : '');
|
|
|
|
|
$valuetoshow .= '<span class="opacitymedium">'.$langs->trans("Hidden").'</span>';
|
|
|
|
|
} else {
|
|
|
|
|
if ($user->admin && $user->id == $object->id) {
|
|
|
|
|
$valuetoshow .= ($valuetoshow ? (' '.$langs->trans("or").' ') : '');
|
|
|
|
|
//$valuetoshow .= '<span class="opacitymedium">'.$langs->trans("Crypted").' - </span>';
|
|
|
|
|
$valuetoshow .= '<span class="opacitymedium">'.$langs->trans("Hidden").'</span>';
|
|
|
|
|
// TODO Add a feature to reveal the hash
|
|
|
|
|
$valuetoshow .= '<!-- Crypted into '.$object->pass_indatabase_crypted.' -->';
|
|
|
|
|
} else {
|
|
|
|
|
$valuetoshow .= ($valuetoshow ? (' '.$langs->trans("or").' ') : '').'<span class="opacitymedium">'.$langs->trans("Hidden").'</span>';
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 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 "</td>";
|
|
|
|
|
print '</tr>'."\n";
|
|
|
|
|
|
|
|
|
|
// API key
|
|
|
|
|
if (!empty($conf->api->enabled) && $user->admin) {
|
|
|
|
|
print '<tr><td>'.$langs->trans("ApiKey").'</td>';
|
|
|
|
|
print '<td>';
|
|
|
|
|
if (!empty($object->api_key)) {
|
|
|
|
|
print '<span class="opacitymedium">'.preg_replace('/./', '*', $object->api_key).'</span>';
|
|
|
|
|
}
|
|
|
|
|
if ($user->admin || $user->id == $object->id) {
|
|
|
|
|
// TODO Add a feature to reveal the hash
|
|
|
|
|
}
|
|
|
|
|
print '</td></tr>';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Administrator
|
|
|
|
|
print '<tr><td>'.$langs->trans("Administrator").'</td><td>';
|
|
|
|
|
if (!empty($conf->multicompany->enabled) && $object->admin && !$object->entity) {
|
|
|
|
|
@ -1480,7 +1420,8 @@ if ($action == 'create' || $action == 'adduserldap') {
|
|
|
|
|
|
|
|
|
|
// Employee
|
|
|
|
|
print '<tr><td>'.$langs->trans("Employee").'</td><td colspan="2">';
|
|
|
|
|
print yn($object->employee);
|
|
|
|
|
print '<input type="checkbox" disabled name="employee" value="1"'.($object->employee ? ' checked="checked"' : '').'>';
|
|
|
|
|
//print yn($object->employee);
|
|
|
|
|
print '</td></tr>'."\n";
|
|
|
|
|
|
|
|
|
|
// TODO Move this into tab RH, visible when salarie or RH is visible (HierarchicalResponsible must be on both tab)
|
|
|
|
|
@ -1604,20 +1545,6 @@ if ($action == 'create' || $action == 'adduserldap') {
|
|
|
|
|
print '</td>';
|
|
|
|
|
print "</tr>\n";
|
|
|
|
|
|
|
|
|
|
// Date login validity
|
|
|
|
|
print '<tr><td>'.$langs->trans("RangeOfLoginValidity").'</td>';
|
|
|
|
|
print '<td>';
|
|
|
|
|
if ($object->datestartvalidity) {
|
|
|
|
|
print '<span class="opacitymedium">'.$langs->trans("FromDate").'</span> ';
|
|
|
|
|
print dol_print_date($object->datestartvalidity, 'day');
|
|
|
|
|
}
|
|
|
|
|
if ($object->dateendvalidity) {
|
|
|
|
|
print '<span class="opacitymedium"> - '.$langs->trans("To").'</span> ';
|
|
|
|
|
print dol_print_date($object->dateendvalidity, 'day');
|
|
|
|
|
}
|
|
|
|
|
print '</td>';
|
|
|
|
|
print "</tr>\n";
|
|
|
|
|
|
|
|
|
|
// Date of birth
|
|
|
|
|
print '<tr><td>'.$langs->trans("DateOfBirth").'</td>';
|
|
|
|
|
print '<td>';
|
|
|
|
|
@ -1637,6 +1564,7 @@ if ($action == 'create' || $action == 'adduserldap') {
|
|
|
|
|
print '<div class="fichehalfright"><div class="ficheaddleft">';
|
|
|
|
|
|
|
|
|
|
print '<div class="underbanner clearboth"></div>';
|
|
|
|
|
|
|
|
|
|
print '<table class="border tableforfield centpercent">';
|
|
|
|
|
|
|
|
|
|
// Color user
|
|
|
|
|
@ -1755,7 +1683,7 @@ if ($action == 'create' || $action == 'adduserldap') {
|
|
|
|
|
print dol_htmlentitiesbr($object->signature);
|
|
|
|
|
print "</td></tr>\n";
|
|
|
|
|
|
|
|
|
|
//VCard
|
|
|
|
|
// VCard
|
|
|
|
|
print '<tr><td class="tdtop">'.$langs->trans("VCard").'</td>';
|
|
|
|
|
print '<td>';
|
|
|
|
|
print '<a href="'.DOL_URL_ROOT.'/user/vcard.php?id='.$object->id.'">';
|
|
|
|
|
@ -1765,6 +1693,97 @@ if ($action == 'create' || $action == 'adduserldap') {
|
|
|
|
|
print "</td></tr>\n";
|
|
|
|
|
|
|
|
|
|
print "</table>\n";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
print '<div class="div-table-responsive-no-min">';
|
|
|
|
|
print '<table class="border tableforfield centpercent">';
|
|
|
|
|
print '<tr class="liste_titre"><td class="liste_titre">';
|
|
|
|
|
print $langs->trans("Credentials");
|
|
|
|
|
print '</td>';
|
|
|
|
|
print '<td></td>';
|
|
|
|
|
print '</tr>';
|
|
|
|
|
|
|
|
|
|
// Date login validity
|
|
|
|
|
print '<tr><td>'.$langs->trans("RangeOfLoginValidity").'</td>';
|
|
|
|
|
print '<td>';
|
|
|
|
|
if ($object->datestartvalidity) {
|
|
|
|
|
print '<span class="opacitymedium">'.$langs->trans("FromDate").'</span> ';
|
|
|
|
|
print dol_print_date($object->datestartvalidity, 'day');
|
|
|
|
|
}
|
|
|
|
|
if ($object->dateendvalidity) {
|
|
|
|
|
print '<span class="opacitymedium"> - '.$langs->trans("To").'</span> ';
|
|
|
|
|
print dol_print_date($object->dateendvalidity, 'day');
|
|
|
|
|
}
|
|
|
|
|
print '</td>';
|
|
|
|
|
print "</tr>\n";
|
|
|
|
|
|
|
|
|
|
// Password
|
|
|
|
|
print '<tr><td class="titlefield">'.$langs->trans("Password").'</td>';
|
|
|
|
|
|
|
|
|
|
print '<td class="wordbreak">';
|
|
|
|
|
$valuetoshow = '';
|
|
|
|
|
if (preg_match('/ldap/', $dolibarr_main_authentication)) {
|
|
|
|
|
if (!empty($object->ldap_sid)) {
|
|
|
|
|
if ($passDoNotExpire) {
|
|
|
|
|
$valuetoshow .= ($valuetoshow ? (' '.$langs->trans("or").' ') : '').$langs->trans("LdapUacf_".$statutUACF);
|
|
|
|
|
} elseif ($userChangePassNextLogon) {
|
|
|
|
|
$valuetoshow .= ($valuetoshow ? (' '.$langs->trans("or").' ') : '').'<span class="warning">'.$langs->trans("UserMustChangePassNextLogon", $ldap->domainFQDN).'</span>';
|
|
|
|
|
} elseif ($userDisabled) {
|
|
|
|
|
$valuetoshow .= ($valuetoshow ? (' '.$langs->trans("or").' ') : '').'<span class="warning">'.$langs->trans("LdapUacf_".$statutUACF, $ldap->domainFQDN).'</span>';
|
|
|
|
|
} else {
|
|
|
|
|
$valuetoshow .= ($valuetoshow ? (' '.$langs->trans("or").' ') : '').$langs->trans("PasswordOfUserInLDAP");
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
$valuetoshow .= ($valuetoshow ? (' '.$langs->trans("or").' ') : '').$langs->trans("PasswordOfUserInLDAP");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (preg_match('/http/', $dolibarr_main_authentication)) {
|
|
|
|
|
$valuetoshow .= ($valuetoshow ? (' '.$langs->trans("or").' ') : '').$langs->trans("HTTPBasicPassword");
|
|
|
|
|
}
|
|
|
|
|
if (preg_match('/dolibarr/', $dolibarr_main_authentication)) {
|
|
|
|
|
if ($object->pass) {
|
|
|
|
|
$valuetoshow .= ($valuetoshow ? (' '.$langs->trans("or").' ') : '');
|
|
|
|
|
$valuetoshow .= '<span class="opacitymedium">'.$langs->trans("Hidden").'</span>';
|
|
|
|
|
} else {
|
|
|
|
|
if ($user->admin && $user->id == $object->id) {
|
|
|
|
|
$valuetoshow .= ($valuetoshow ? (' '.$langs->trans("or").' ') : '');
|
|
|
|
|
//$valuetoshow .= '<span class="opacitymedium">'.$langs->trans("Crypted").' - </span>';
|
|
|
|
|
$valuetoshow .= '<span class="opacitymedium">'.$langs->trans("Hidden").'</span>';
|
|
|
|
|
// TODO Add a feature to reveal the hash
|
|
|
|
|
$valuetoshow .= '<!-- Crypted into '.$object->pass_indatabase_crypted.' -->';
|
|
|
|
|
} else {
|
|
|
|
|
$valuetoshow .= ($valuetoshow ? (' '.$langs->trans("or").' ') : '').'<span class="opacitymedium">'.$langs->trans("Hidden").'</span>';
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 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 "</td>";
|
|
|
|
|
print '</tr>'."\n";
|
|
|
|
|
|
|
|
|
|
// API key
|
|
|
|
|
if (!empty($conf->api->enabled) && $user->admin) {
|
|
|
|
|
print '<tr><td>'.$langs->trans("ApiKey").'</td>';
|
|
|
|
|
print '<td>';
|
|
|
|
|
if (!empty($object->api_key)) {
|
|
|
|
|
print '<span class="opacitymedium">'.preg_replace('/./', '*', $object->api_key).'</span>';
|
|
|
|
|
}
|
|
|
|
|
if ($user->admin || $user->id == $object->id) {
|
|
|
|
|
// TODO Add a feature to reveal the hash
|
|
|
|
|
}
|
|
|
|
|
print '</td></tr>';
|
|
|
|
|
}
|
|
|
|
|
print '</table></div>';
|
|
|
|
|
|
|
|
|
|
print '</div>';
|
|
|
|
|
|
|
|
|
|
print '</div></div>';
|
|
|
|
|
@ -2011,47 +2030,6 @@ if ($action == 'create' || $action == 'adduserldap') {
|
|
|
|
|
print '</td>';
|
|
|
|
|
print '</tr>';
|
|
|
|
|
|
|
|
|
|
// Pass
|
|
|
|
|
print '<tr><td>'.$langs->trans("Password").'</td>';
|
|
|
|
|
print '<td>';
|
|
|
|
|
$valuetoshow = '';
|
|
|
|
|
if (preg_match('/ldap/', $dolibarr_main_authentication)) {
|
|
|
|
|
$valuetoshow .= ($valuetoshow ? (' '.$langs->trans("or").' ') : '').$langs->trans("PasswordOfUserInLDAP");
|
|
|
|
|
}
|
|
|
|
|
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 ($caneditpassword) {
|
|
|
|
|
$valuetoshow .= ($valuetoshow ? (' '.$langs->trans("or").' ') : '').'<input maxlength="32" type="password" class="flat" name="password" value="'.$object->pass.'" autocomplete="new-password">';
|
|
|
|
|
} 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
|
|
|
|
|
if ($reshook > 0) {
|
|
|
|
|
$valuetoshow = $hookmanager->resPrint; // to replace
|
|
|
|
|
} else {
|
|
|
|
|
$valuetoshow .= $hookmanager->resPrint; // to add
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
print $valuetoshow;
|
|
|
|
|
print "</td></tr>\n";
|
|
|
|
|
|
|
|
|
|
// API key
|
|
|
|
|
if (!empty($conf->api->enabled) && $user->admin) {
|
|
|
|
|
print '<tr><td>'.$langs->trans("ApiKey").'</td>';
|
|
|
|
|
print '<td>';
|
|
|
|
|
print '<input class="minwidth300" maxsize="32" type="text" id="api_key" name="api_key" value="'.$object->api_key.'" autocomplete="off">';
|
|
|
|
|
if (!empty($conf->use_javascript_ajax)) {
|
|
|
|
|
print ' '.img_picto($langs->trans('Generate'), 'refresh', 'id="generate_api_key" class="linkobject"');
|
|
|
|
|
}
|
|
|
|
|
print '</td></tr>';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Administrator
|
|
|
|
|
print '<tr><td>'.$langs->trans("Administrator").'</td>';
|
|
|
|
|
if ($object->socid > 0) {
|
|
|
|
|
@ -2145,13 +2123,15 @@ if ($action == 'create' || $action == 'adduserldap') {
|
|
|
|
|
print '<tr>';
|
|
|
|
|
print '<td>'.$form->editfieldkey('Employee', 'employee', '', $object, 0).'</td><td>';
|
|
|
|
|
if ($caneditfield) {
|
|
|
|
|
print $form->selectyesno("employee", $object->employee, 1);
|
|
|
|
|
print '<input type="checkbox" name="employee" value="1"'.($object->employee ? ' checked="checked"' : '').'>';
|
|
|
|
|
//print $form->selectyesno("employee", $object->employee, 1);
|
|
|
|
|
} else {
|
|
|
|
|
if ($object->employee) {
|
|
|
|
|
print '<input type="checkbox" name="employee" disabled value="1"'.($object->employee ? ' checked="checked"' : '').'>';
|
|
|
|
|
/*if ($object->employee) {
|
|
|
|
|
print $langs->trans("Yes");
|
|
|
|
|
} else {
|
|
|
|
|
print $langs->trans("No");
|
|
|
|
|
}
|
|
|
|
|
}*/
|
|
|
|
|
}
|
|
|
|
|
print '</td></tr>';
|
|
|
|
|
|
|
|
|
|
@ -2246,6 +2226,74 @@ if ($action == 'create' || $action == 'adduserldap') {
|
|
|
|
|
}
|
|
|
|
|
print '</td></tr>';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
print '</table><hr><table class="border centpercent">';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Date access validity
|
|
|
|
|
print '<tr><td>'.$langs->trans("RangeOfLoginValidity").'</td>';
|
|
|
|
|
print '<td>';
|
|
|
|
|
if ($caneditfield) {
|
|
|
|
|
print $form->selectDate($datestartvalidity ? $datestartvalidity : $object->datestartvalidity, 'datestartvalidity', 0, 0, 1, 'formdatestartvalidity', 1, 1, 0, '', '', '', '', 1, '', '');
|
|
|
|
|
} else {
|
|
|
|
|
print dol_print_date($object->datestartvalidity, 'day');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*if ($datestartvalidity && $dateendvalidity) {
|
|
|
|
|
print ' - ';
|
|
|
|
|
}*/
|
|
|
|
|
print ' ';
|
|
|
|
|
|
|
|
|
|
if ($caneditfield) {
|
|
|
|
|
print $form->selectDate($dateendvalidity ? $datendevalidity : $object->dateendvalidity, 'dateendvalidity', 0, 0, 1, 'formdateendvalidity', 1, 0, 0, '', '', '', '', 1, '', '');
|
|
|
|
|
} else {
|
|
|
|
|
print dol_print_date($object->dateendvalidity, 'day');
|
|
|
|
|
}
|
|
|
|
|
print '</td>';
|
|
|
|
|
print "</tr>\n";
|
|
|
|
|
|
|
|
|
|
// Pass
|
|
|
|
|
print '<tr><td class="titlefieldcreate">'.$langs->trans("Password").'</td>';
|
|
|
|
|
print '<td>';
|
|
|
|
|
$valuetoshow = '';
|
|
|
|
|
if (preg_match('/ldap/', $dolibarr_main_authentication)) {
|
|
|
|
|
$valuetoshow .= ($valuetoshow ? (' '.$langs->trans("or").' ') : '').$langs->trans("PasswordOfUserInLDAP");
|
|
|
|
|
}
|
|
|
|
|
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 ($caneditpassword) {
|
|
|
|
|
$valuetoshow .= ($valuetoshow ? (' '.$langs->trans("or").' ') : '').'<input maxlength="32" type="password" class="flat" name="password" value="'.$object->pass.'" autocomplete="new-password">';
|
|
|
|
|
} 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
|
|
|
|
|
if ($reshook > 0) {
|
|
|
|
|
$valuetoshow = $hookmanager->resPrint; // to replace
|
|
|
|
|
} else {
|
|
|
|
|
$valuetoshow .= $hookmanager->resPrint; // to add
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
print $valuetoshow;
|
|
|
|
|
print "</td></tr>\n";
|
|
|
|
|
|
|
|
|
|
// API key
|
|
|
|
|
if (!empty($conf->api->enabled) && $user->admin) {
|
|
|
|
|
print '<tr><td>'.$langs->trans("ApiKey").'</td>';
|
|
|
|
|
print '<td>';
|
|
|
|
|
print '<input class="minwidth300" maxsize="32" type="text" id="api_key" name="api_key" value="'.$object->api_key.'" autocomplete="off">';
|
|
|
|
|
if (!empty($conf->use_javascript_ajax)) {
|
|
|
|
|
print ' '.img_picto($langs->trans('Generate'), 'refresh', 'id="generate_api_key" class="linkobject"');
|
|
|
|
|
}
|
|
|
|
|
print '</td></tr>';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
print '</table><hr><table class="border centpercent">';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -2636,29 +2684,6 @@ if ($action == 'create' || $action == 'adduserldap') {
|
|
|
|
|
print '</td>';
|
|
|
|
|
print "</tr>\n";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Date login validity
|
|
|
|
|
print '<tr><td>'.$langs->trans("RangeOfLoginValidity").'</td>';
|
|
|
|
|
print '<td>';
|
|
|
|
|
if ($caneditfield) {
|
|
|
|
|
print $form->selectDate($datestartvalidity ? $datestartvalidity : $object->datestartvalidity, 'datestartvalidity', 0, 0, 1, 'formdatestartvalidity', 1, 1);
|
|
|
|
|
} else {
|
|
|
|
|
print dol_print_date($object->datestartvalidity, 'day');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ($datestartvalidity && $dateendvalidity) {
|
|
|
|
|
print ' - ';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ($caneditfield) {
|
|
|
|
|
print $form->selectDate($dateendvalidity ? $datendevalidity : $object->dateendvalidity, 'dateendvalidity', 0, 0, 1, 'formdateendvalidity', 1, 0);
|
|
|
|
|
} else {
|
|
|
|
|
print dol_print_date($object->dateendvalidity, 'day');
|
|
|
|
|
}
|
|
|
|
|
print '</td>';
|
|
|
|
|
print "</tr>\n";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Date birth
|
|
|
|
|
print '<tr><td>'.$langs->trans("DateOfBirth").'</td>';
|
|
|
|
|
print '<td>';
|
|
|
|
|
|