[FE][Classroom] Fixex #10 Fix the system generating invalid usernames
This commit is contained in:
parent
5f1a46747a
commit
b2774f7783
@ -31,7 +31,17 @@ export function ClassroomUserCreation(props: {
|
||||
const paternalSurname = props.person.person_paternal_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();
|
||||
next_date.setDate(next_date.getDate() + 60);
|
||||
|
Loading…
Reference in New Issue
Block a user