Skip to content

Commit

Permalink
fix(ui): handle missing update time on user (#397)
Browse files Browse the repository at this point in the history
  • Loading branch information
bouassaba authored Nov 27, 2024
1 parent e3572a1 commit 646a923
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
12 changes: 8 additions & 4 deletions ui/src/components/sign-up/password-hints.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,28 +40,32 @@ function hasMinLength(value: string, minimum: number): boolean {

function hasMinLowerCase(value: string, minimum: number): boolean {
const lowerCaseCount = Array.from(value).filter(
(char) => char === char.toLowerCase() && char !== char.toUpperCase(),
(character) =>
character === character.toLowerCase() &&
character !== character.toUpperCase(),
).length
return lowerCaseCount >= minimum
}

function hasMinUpperCase(value: string, minimum: number): boolean {
const upperCaseCount = Array.from(value).filter(
(char) => char === char.toUpperCase() && char !== char.toLowerCase(),
(character) =>
character === character.toUpperCase() &&
character !== character.toLowerCase(),
).length
return upperCaseCount >= minimum
}

function hasMinNumbers(value: string, minimum: number): boolean {
const numbersCount = Array.from(value).filter(
(char) => !isNaN(Number(char)),
(character) => !isNaN(Number(character)),
).length
return numbersCount >= minimum
}

function hasMinSymbols(value: string, minimum: number): boolean {
const symbolsCount = Array.from(value).filter(
(char) => !char.match(/[a-zA-Z0-9\s]/),
(character) => !character.match(/[a-zA-Z0-9\s]/),
).length
return symbolsCount >= minimum
}
Expand Down
6 changes: 5 additions & 1 deletion ui/src/pages/console/console-panel-users.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,11 @@ const ConsolePanelUsers = () => {
{
title: 'Updated',
renderCell: (user) => (
<RelativeDate date={new Date(user.updateTime)} />
<>
{user.updateTime ? (
<RelativeDate date={new Date(user.updateTime)} />
) : null}
</>
),
},
{
Expand Down

0 comments on commit 646a923

Please sign in to comment.