Skip to content

Commit

Permalink
Fix duplicate username login issue
Browse files Browse the repository at this point in the history
  • Loading branch information
naueramant committed May 22, 2024
1 parent 16873e7 commit f224e4b
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/views/Login/New/components/PlayerItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,18 @@ const PlayerItem: FunctionComponent<PlayerItemProps> = (props) => {
return;
}

const isPlayerWithSameUsernameLoggedIn = newGame.players.some(
(p) =>
p.username.toLowerCase() === player.username.toLowerCase() && p.ready,
);

if (isPlayerWithSameUsernameLoggedIn) {
play("snack");
updatePassword("");

return;
}

try {
setDisabled(true);

Expand Down

0 comments on commit f224e4b

Please sign in to comment.