1
0
mirror of https://github.com/kakwa/ldapcherry synced 2024-11-23 01:44:22 +01:00
ldapcherry/resources/static/js/lc-filler.js

33 lines
925 B
JavaScript
Raw Normal View History

2015-07-08 00:42:53 +02:00
/*
* Licensed under the MIT public license.
*
* Part of LdapCherry.
*
* Functions to autofill form fields from other fields.
*
*/
function lcUid(firstname, lastname){
var ascii_firstname = removeDiacritics(firstname).toLowerCase().replace(/[^a-z]/g, '');
var ascii_lastname = removeDiacritics(lastname).toLowerCase().replace(/[^a-z]/g, '');
return ascii_firstname.charAt(0)+ascii_lastname.substring(0,7);
2015-07-08 00:42:53 +02:00
}
function lcDisplayName(firstname, lastname){
2015-07-08 00:59:23 +02:00
return firstname+' '+lastname;
2015-07-08 00:42:53 +02:00
}
function lcMail(firstname, lastname, domain){
return lcUid(firstname, lastname)+domain;
2015-07-08 00:42:53 +02:00
}
function lcUidNumber(firstname, lastname, minuid, maxuid){
var iminuid = parseInt(minuid);
var imaxuid = parseInt(maxuid);
2016-06-18 18:48:50 +02:00
return (parseInt('0x'+sha1(firstname+lastname)) % (imaxuid - iminuid)) + iminuid;
2015-07-08 00:42:53 +02:00
}
function lcHomeDir(firstname, lastname, basedir){
return basedir+lcUid(firstname, lastname);
2015-07-08 00:42:53 +02:00
}