Merge pull request #1827 from FlowerC9/fix/username-flexibility-added

Fix/username flexibility added
This commit is contained in:
Alexander Holliday
2025-02-27 12:04:46 -08:00
committed by GitHub
2 changed files with 31 additions and 6 deletions

View File

@@ -628,10 +628,19 @@ function Sidebar() {
) : (
<>
<Avatar small={true} />
<Box ml={theme.spacing(2)}>
<Box
ml={theme.spacing(2)}
sx={{ maxWidth: "50%", overflow: "hidden" }}
>
<Typography
component="span"
fontWeight={500}
sx={{
display: "block",
whiteSpace: "nowrap",
overflow: "hidden",
textOverflow: "ellipsis",
}}
>
{authState.user?.firstName} {authState.user?.lastName}
</Typography>
@@ -706,12 +715,21 @@ function Sidebar() {
}}
>
{collapsed && (
<MenuItem sx={{ cursor: "default", minWidth: "150px" }}>
<Box mb={theme.spacing(2)}>
<MenuItem sx={{ cursor: "default", minWidth: "50%" }}>
<Box
mb={theme.spacing(2)}
sx={{ maxWidth: "50%", overflow: "hidden" }}
>
<Typography
component="span"
fontWeight={500}
fontSize={13}
sx={{
display: "block",
whiteSpace: "nowrap",
overflow: "hidden",
textOverflow: "ellipsis",
}}
>
{authState.user?.firstName} {authState.user?.lastName}
</Typography>

View File

@@ -7,11 +7,18 @@ const nameSchema = joi
.string()
.max(50)
.trim()
.pattern(/^[A-Za-z]+$/)
.pattern(/^(?=.*[\p{L}\p{Sc}])[\p{L}\p{Sc}\s']+$/u, {
name: "name.containsLetterOrSymbol",
})
.pattern(/^[\p{L}\p{Sc}\s']+$/u, {
name: "name.validCharacters",
})
.messages({
"string.empty": "Name is required",
"string.max": "Name must be less than 50 characters long",
"string.pattern.base": "Name must contain only letters",
"string.max": "Name must be less than 50 characters",
"string.pattern.name": "Name must contain at least 1 letter or currency symbol",
"string.pattern.base.validCharacters":
"Can only contain letters, spaces, apostrophes, and currency symbols",
});
const passwordSchema = joi