[FE] Fixes #34, #23: Fix online username generation

This commit is contained in:
Araozu 2023-12-11 16:05:56 -05:00
parent fd4d31e0a5
commit 673cd96a01

View File

@ -32,13 +32,18 @@ export function ClassroomUserCreation(props: {
const maternalSurname = props.person.person_maternal_surname; const maternalSurname = props.person.person_maternal_surname;
// The username may be composed of A-Z & 0-9. // The username may be composed of A-Z & 0-9.
const user = `${firstName[0]}${secondName?.[0] ?? ""}${paternalSurname}${maternalSurname[0]}` const user = `${firstName[0]}${secondName?.[0] ?? ""}${paternalSurname}${maternalSurname?.[0] ?? ""}`
.toUpperCase() .toUpperCase()
.replaceAll("Á", "A") .replaceAll("Á", "A")
.replaceAll("É", "E") .replaceAll("É", "E")
.replaceAll("Í", "I") .replaceAll("Í", "I")
.replaceAll("Ó", "O") .replaceAll("Ó", "O")
.replaceAll("Ú", "U") .replaceAll("Ú", "U")
.replaceAll("Ä", "A")
.replaceAll("Ë", "E")
.replaceAll("Ï", "I")
.replaceAll("Ö", "O")
.replaceAll("Ü", "U")
.replaceAll("Ñ", "N") .replaceAll("Ñ", "N")
.replaceAll(" ", "") .replaceAll(" ", "")
.replaceAll("-", ""); .replaceAll("-", "");