From dcd7162ca92594127e3de911daf1e0dd3d5bd539 Mon Sep 17 00:00:00 2001 From: Christian Connert Date: Tue, 9 Jul 2019 15:15:59 +0200 Subject: [PATCH] Added extended Uid function --- resources/static/js/lc-filler.js | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/resources/static/js/lc-filler.js b/resources/static/js/lc-filler.js index 4bfb5f3..1aa6fa3 100644 --- a/resources/static/js/lc-filler.js +++ b/resources/static/js/lc-filler.js @@ -7,16 +7,26 @@ * */ +function normalizeName(name) { + return removeDiacritics(name).toLowerCase().replace(/[^a-z]/g, ''); +} + +function lcUidExt(firstname, lastname, firstnameEnd, lastnameEnd){ + return normalizeName(firstname).substring(0, parseInt(firstnameEnd))+normalizeName(lastname).substring(0,parseInt(lastnameEnd)); +} + 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); + return lcUidExt(firstname, lastname, 0, 7); } function lcDisplayName(firstname, lastname){ return firstname+' '+lastname; } +function lcMailExt(firstname, lastname, domain, firstnameEnd, lastnameEnd){ + return lcUidExt(firstname, lastname, firstnameEnd, lastnameEnd)+domain; +} + function lcMail(firstname, lastname, domain){ return lcUid(firstname, lastname)+domain; }