feat(backend): handle username always in lowercase

This should make all usernames of new users into lowercase. Usernames are also searched in the DB as lowercase.

Signed-off-by: Philip Molares <philip.molares@udo.edu>
Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de>
This commit is contained in:
Philip Molares 2023-05-13 14:56:42 +02:00 committed by Tilman Vatteroth
parent 9625900d1c
commit 0a8945d934
23 changed files with 99 additions and 58 deletions

View file

@ -1,13 +1,14 @@
/*
* SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
* SPDX-FileCopyrightText: 2023 The HedgeDoc developers (see AUTHORS file)
*
* SPDX-License-Identifier: AGPL-3.0-only
*/
import { ApiProperty } from '@nestjs/swagger';
import { Type } from 'class-transformer';
import { IsDate, IsOptional, IsString } from 'class-validator';
import { IsDate, IsLowercase, IsOptional, IsString } from 'class-validator';
import { BaseDto } from '../utils/base.dto.';
import { Username } from '../utils/username';
export class MediaUploadDto extends BaseDto {
/**
@ -41,6 +42,7 @@ export class MediaUploadDto extends BaseDto {
* @example "testuser5"
*/
@IsString()
@IsLowercase()
@ApiProperty()
username: string | null;
username: Username | null;
}