[FE][Classroom] Fixex #10 Fix the system generating invalid usernames

This commit is contained in:
Araozu 2023-10-11 14:46:33 -05:00
parent 5f1a46747a
commit b2774f7783

View File

@ -31,7 +31,17 @@ export function ClassroomUserCreation(props: {
const paternalSurname = props.person.person_paternal_surname; const paternalSurname = props.person.person_paternal_surname;
const maternalSurname = props.person.person_maternal_surname; const maternalSurname = props.person.person_maternal_surname;
const user = `${firstName[0]}${secondName?.[0] ?? ""}${paternalSurname}${maternalSurname[0]}`; // The username may be composed of A-Z & 0-9.
const user = `${firstName[0]}${secondName?.[0] ?? ""}${paternalSurname}${maternalSurname[0]}`
.toUpperCase()
.replaceAll("Á", "A")
.replaceAll("É", "E")
.replaceAll("Í", "I")
.replaceAll("Ó", "O")
.replaceAll("Ú", "U")
.replaceAll("Ñ", "N")
.replaceAll(" ", "")
.replaceAll("-", "");
const next_date = new Date(); const next_date = new Date();
next_date.setDate(next_date.getDate() + 60); next_date.setDate(next_date.getDate() + 60);