different new username when another one exist at the first connection
This commit is contained in:
@@ -24,10 +24,12 @@ export class AuthenticationService {
|
|||||||
if (!check_name)
|
if (!check_name)
|
||||||
return await this.userService.create(createUsersDto);
|
return await this.userService.create(createUsersDto);
|
||||||
let createUsersDtoWithUsername : CreateUsersDto = createUsersDto;
|
let createUsersDtoWithUsername : CreateUsersDto = createUsersDto;
|
||||||
|
let i = 0;
|
||||||
while (check_name === true)
|
while (check_name === true)
|
||||||
{
|
{
|
||||||
createUsersDtoWithUsername = { ...createUsersDto, username: createUsersDto.username + randomUUID() };
|
createUsersDtoWithUsername = { ...createUsersDto, username: createUsersDto.username + '_' + i};
|
||||||
check_name = await this.userService.isUsernameExists(createUsersDtoWithUsername.username);
|
check_name = await this.userService.isUsernameExists(createUsersDtoWithUsername.username);
|
||||||
|
i++;
|
||||||
}
|
}
|
||||||
return this.userService.create(createUsersDtoWithUsername);
|
return this.userService.create(createUsersDtoWithUsername);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user