Merge remote-tracking branch 'origin/master' into eric_front_and_back
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);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -372,11 +372,14 @@ export class ChatService {
|
|||||||
async getListBlockUser(username: string): Promise<string[]>
|
async getListBlockUser(username: string): Promise<string[]>
|
||||||
{
|
{
|
||||||
printCaller("-- in ");
|
printCaller("-- in ");
|
||||||
|
let users: string[] = [];
|
||||||
let user = await this.getUserByName(username);
|
let user = await this.getUserByName(username);
|
||||||
let friends_users = await this.friendshipService.findAllBlockedFriends(user.id);
|
console.log("USERNAME CHAT SRVICE " + username);
|
||||||
let users = friends_users.map(user => user.receiverUsername);
|
let friends_users;
|
||||||
|
if (user)
|
||||||
|
friends_users = await this.friendshipService.findAllBlockedFriends(user.id);
|
||||||
|
if (friends_users)
|
||||||
|
users = friends_users.map(user => user.receiverUsername);
|
||||||
printCaller("-- out ");
|
printCaller("-- out ");
|
||||||
return users;
|
return users;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,11 @@
|
|||||||
import { IsBoolean, IsEmail, IsNotEmpty, IsOptional, IsString } from 'class-validator';
|
import { IsBoolean, Matches, MaxLength, IsEmail, IsNotEmpty, IsOptional, IsString } from 'class-validator';
|
||||||
import { isSet } from 'util/types';
|
import { isSet } from 'util/types';
|
||||||
|
|
||||||
export class CreateUsersDto {
|
export class CreateUsersDto {
|
||||||
@IsString()
|
@IsString()
|
||||||
@IsNotEmpty()
|
@IsNotEmpty()
|
||||||
|
@Matches(/^[a-zA-Z0-9'-_]+$/)
|
||||||
|
@MaxLength(50)
|
||||||
readonly username: string;
|
readonly username: string;
|
||||||
readonly fortyTwoId: string;
|
readonly fortyTwoId: string;
|
||||||
@IsEmail()
|
@IsEmail()
|
||||||
|
|||||||
@@ -26,6 +26,16 @@ body {
|
|||||||
font-display: swap;
|
font-display: swap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@font-face {
|
||||||
|
font-family: "Bit5x3";
|
||||||
|
src:
|
||||||
|
url("/fonts/Bit5x3.woff2") format("woff2"),
|
||||||
|
local("Bit5x3"),
|
||||||
|
url("/fonts/Bit5x3.woff") format("woff");
|
||||||
|
font-weight: normal;
|
||||||
|
font-style: normal;
|
||||||
|
font-display: swap;
|
||||||
|
}
|
||||||
|
|
||||||
a {
|
a {
|
||||||
color: rgb(0,100,200);
|
color: rgb(0,100,200);
|
||||||
|
|||||||
@@ -390,19 +390,20 @@
|
|||||||
{/if}
|
{/if}
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
|
<div id="preload_font">.</div>
|
||||||
|
|
||||||
</div> <!-- div "game_page" -->
|
</div> <!-- div "game_page" -->
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
@font-face {
|
|
||||||
|
#preload_font {
|
||||||
font-family: "Bit5x3";
|
font-family: "Bit5x3";
|
||||||
src:
|
opacity:0;
|
||||||
url("/fonts/Bit5x3.woff2") format("woff2"),
|
height:0;
|
||||||
local("Bit5x3"),
|
width:0;
|
||||||
url("/fonts/Bit5x3.woff") format("woff");
|
display:inline-block;
|
||||||
font-weight: normal;
|
|
||||||
font-style: normal;
|
|
||||||
font-display: swap;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.dim_background {
|
.dim_background {
|
||||||
background-color: #222;
|
background-color: #222;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -175,19 +175,19 @@
|
|||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
|
<div id="preload_font">.</div>
|
||||||
|
|
||||||
</div> <!-- div "game_page" -->
|
</div> <!-- div "game_page" -->
|
||||||
|
|
||||||
<!-- -->
|
<!-- -->
|
||||||
<style>
|
<style>
|
||||||
@font-face {
|
|
||||||
|
#preload_font {
|
||||||
font-family: "Bit5x3";
|
font-family: "Bit5x3";
|
||||||
src:
|
opacity:0;
|
||||||
url("/fonts/Bit5x3.woff2") format("woff2"),
|
height:0;
|
||||||
local("Bit5x3"),
|
width:0;
|
||||||
url("/fonts/Bit5x3.woff") format("woff");
|
display:inline-block;
|
||||||
font-weight: normal;
|
|
||||||
font-style: normal;
|
|
||||||
font-display: swap;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.dim_background {
|
.dim_background {
|
||||||
|
|||||||
@@ -51,7 +51,7 @@
|
|||||||
.then((response) => {
|
.then((response) => {
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
success.username = ''
|
success.username = ''
|
||||||
errors.username = "Something went wrong";
|
errors.username = "Max length : 50 . Use [a-zA-Z0-9] and - _ .";
|
||||||
if (response.status === 409) {
|
if (response.status === 409) {
|
||||||
errors.username = `${set.username} is already in use, pick a different one.`;
|
errors.username = `${set.username} is already in use, pick a different one.`;
|
||||||
}
|
}
|
||||||
@@ -93,9 +93,11 @@
|
|||||||
)
|
)
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
|
success.avatar = ''
|
||||||
errors.avatar = response.statusText;
|
errors.avatar = response.statusText;
|
||||||
throw new Error("HTTP " + response.status);
|
throw new Error("HTTP " + response.status);
|
||||||
}
|
}
|
||||||
|
errors.avatar = ''
|
||||||
uploadAvatarSuccess = true;
|
uploadAvatarSuccess = true;
|
||||||
success.avatar = 'Your avatar has been updated';
|
success.avatar = 'Your avatar has been updated';
|
||||||
})
|
})
|
||||||
@@ -144,6 +146,7 @@
|
|||||||
<div class="label">Pick a new Avatar</div>
|
<div class="label">Pick a new Avatar</div>
|
||||||
<input type="file" bind:files={newAvatar}/>
|
<input type="file" bind:files={newAvatar}/>
|
||||||
<div class="error">{errors.avatar}</div>
|
<div class="error">{errors.avatar}</div>
|
||||||
|
<div class="success">{success.avatar}</div>
|
||||||
</div>
|
</div>
|
||||||
<Button type={!newAvatar ? "primary" : "secondary"}>Upload Avatar</Button>
|
<Button type={!newAvatar ? "primary" : "secondary"}>Upload Avatar</Button>
|
||||||
</form>
|
</form>
|
||||||
@@ -189,6 +192,7 @@
|
|||||||
|
|
||||||
.form-field {
|
.form-field {
|
||||||
padding: 10px;
|
padding: 10px;
|
||||||
|
color: #333;
|
||||||
}
|
}
|
||||||
|
|
||||||
.label {
|
.label {
|
||||||
|
|||||||
Reference in New Issue
Block a user