Merge pull request #24372 from Hystepik/develop#1
New : Creation of login from lastname and firstname
This commit is contained in:
commit
fccd517acb
@ -893,7 +893,7 @@ if ($action == 'create' || $action == 'adduserldap') {
|
|||||||
print '<input type="hidden" id="lastname" name="lastname" value="'.dol_escape_htmltag($ldap_lastname).'">';
|
print '<input type="hidden" id="lastname" name="lastname" value="'.dol_escape_htmltag($ldap_lastname).'">';
|
||||||
print $ldap_lastname;
|
print $ldap_lastname;
|
||||||
} else {
|
} else {
|
||||||
print '<input class="minwidth100 maxwidth150onsmartphone" type="text" id="lastname" name="lastname" value="'.dol_escape_htmltag(GETPOST('lastname', 'alphanohtml')).'">';
|
print '<input class="minwidth100 maxwidth150onsmartphone createloginauto" type="text" id="lastname" name="lastname" value="'.dol_escape_htmltag(GETPOST('lastname', 'alphanohtml')).'">';
|
||||||
}
|
}
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
@ -904,7 +904,7 @@ if ($action == 'create' || $action == 'adduserldap') {
|
|||||||
print '<input type="hidden" name="firstname" value="'.dol_escape_htmltag($ldap_firstname).'">';
|
print '<input type="hidden" name="firstname" value="'.dol_escape_htmltag($ldap_firstname).'">';
|
||||||
print $ldap_firstname;
|
print $ldap_firstname;
|
||||||
} else {
|
} else {
|
||||||
print '<input class="minwidth100 maxwidth150onsmartphone" type="text" name="firstname" value="'.dol_escape_htmltag(GETPOST('firstname', 'alphanohtml')).'">';
|
print '<input id="firstname" class="minwidth100 maxwidth150onsmartphone createloginauto" type="text" name="firstname" value="'.dol_escape_htmltag(GETPOST('firstname', 'alphanohtml')).'">';
|
||||||
}
|
}
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
@ -918,10 +918,28 @@ if ($action == 'create' || $action == 'adduserldap') {
|
|||||||
print '<input type="hidden" name="login" value="'.dol_escape_htmltag($ldap_loginsmb).'">';
|
print '<input type="hidden" name="login" value="'.dol_escape_htmltag($ldap_loginsmb).'">';
|
||||||
print $ldap_loginsmb;
|
print $ldap_loginsmb;
|
||||||
} else {
|
} else {
|
||||||
print '<input class="maxwidth200 maxwidth150onsmartphone" maxsize="24" type="text" name="login" value="'.dol_escape_htmltag(GETPOST('login', 'alphanohtml')).'">';
|
print '<input id="login" class="maxwidth200 maxwidth150onsmartphone" maxsize="24" type="text" name="login" value="'.dol_escape_htmltag(GETPOST('login', 'alphanohtml')).'">';
|
||||||
}
|
}
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
|
if (!empty($conf->use_javascript_ajax)) {
|
||||||
|
print '<script>
|
||||||
|
jQuery(document).ready(function() {
|
||||||
|
$(".createloginauto").on("change", function(){
|
||||||
|
lastname = $("#lastname").val();
|
||||||
|
firstname = $("#firstname").val();
|
||||||
|
if($(this).attr("id") == "firstname"){
|
||||||
|
firstname = firstname.toLowerCase();
|
||||||
|
firstname = firstname[0];
|
||||||
|
}
|
||||||
|
lastname = lastname.toLowerCase();
|
||||||
|
console.log("We create a login from firstname and lastname");
|
||||||
|
$("#login").val(firstname+lastname);
|
||||||
|
})
|
||||||
|
});
|
||||||
|
</script>';
|
||||||
|
}
|
||||||
|
|
||||||
$generated_password = '';
|
$generated_password = '';
|
||||||
if (empty($ldap_sid)) { // ldap_sid is for activedirectory
|
if (empty($ldap_sid)) { // ldap_sid is for activedirectory
|
||||||
$generated_password = getRandomPassword(false);
|
$generated_password = getRandomPassword(false);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user