Skip to content

Commit

Permalink
fix: sanitize userId
Browse files Browse the repository at this point in the history
  • Loading branch information
oliverlaz committed Sep 26, 2023
1 parent e8083ba commit 7bb1910
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ const config: Config = {

export const generateUser = (): User => {
const { user_id, user_name, id } = getURLCredentials();
const characterName: string = uniqueNamesGenerator(config);
const characterName = uniqueNamesGenerator(config);

const userName: string = user_name ?? `${characterName}`;
const userId: string = user_id ?? `demo-${userName}-${uuid()}`;
const userName = user_name ?? characterName;
const userId = user_id ?? `demo-${userName}-${uuid()}`;

return {
id: userId,
id: userId.replace(/[^_\-0-9a-zA-Z@]/g, '_'),
name: userName,
role: id ? 'user' : 'admin',
teams: ['@stream-io/video-demo'],
Expand Down

0 comments on commit 7bb1910

Please sign in to comment.