mirror of
https://github.com/immich-app/immich.git
synced 2024-11-24 08:52:28 +02:00
Fixed different lettercases in email create different user (#470)
* Fixed different lettercases in email create different user * Fixed test
This commit is contained in:
parent
c1b22125fd
commit
86f780871c
@ -25,7 +25,7 @@ export class AuthController {
|
||||
|
||||
@Post('/login')
|
||||
async login(
|
||||
@Body(ValidationPipe) loginCredential: LoginCredentialDto,
|
||||
@Body(new ValidationPipe({ transform: true })) loginCredential: LoginCredentialDto,
|
||||
@Res() response: Response,
|
||||
): Promise<LoginResponseDto> {
|
||||
const loginResponse = await this.authService.login(loginCredential);
|
||||
@ -42,7 +42,9 @@ export class AuthController {
|
||||
|
||||
@Post('/admin-sign-up')
|
||||
@ApiBadRequestResponse({ description: 'The server already has an admin' })
|
||||
async adminSignUp(@Body(ValidationPipe) signUpCredential: SignUpDto): Promise<AdminSignupResponseDto> {
|
||||
async adminSignUp(
|
||||
@Body(new ValidationPipe({ transform: true })) signUpCredential: SignUpDto,
|
||||
): Promise<AdminSignupResponseDto> {
|
||||
return await this.authService.adminSignUp(signUpCredential);
|
||||
}
|
||||
|
||||
@ -61,8 +63,7 @@ export class AuthController {
|
||||
|
||||
const status = new LogoutResponseDto(true);
|
||||
|
||||
response.send(status)
|
||||
response.send(status);
|
||||
return status;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,9 +1,11 @@
|
||||
import { ApiProperty } from '@nestjs/swagger';
|
||||
import { Transform } from 'class-transformer';
|
||||
import { IsNotEmpty } from 'class-validator';
|
||||
|
||||
export class LoginCredentialDto {
|
||||
@IsNotEmpty()
|
||||
@ApiProperty({ example: 'testuser@email.com' })
|
||||
@Transform(({ value }) => value?.toLowerCase())
|
||||
email!: string;
|
||||
|
||||
@IsNotEmpty()
|
||||
|
@ -1,9 +1,11 @@
|
||||
import { ApiProperty } from '@nestjs/swagger';
|
||||
import { Transform } from 'class-transformer';
|
||||
import { IsNotEmpty, IsEmail } from 'class-validator';
|
||||
|
||||
export class SignUpDto {
|
||||
@IsEmail()
|
||||
@ApiProperty({ example: 'testuser@email.com' })
|
||||
@Transform(({ value }) => value?.toLowerCase())
|
||||
email!: string;
|
||||
|
||||
@IsNotEmpty()
|
||||
|
@ -1,8 +1,10 @@
|
||||
import { ApiProperty } from '@nestjs/swagger';
|
||||
import { Transform } from 'class-transformer';
|
||||
import { IsNotEmpty, IsEmail } from 'class-validator';
|
||||
|
||||
export class CreateUserDto {
|
||||
@IsEmail()
|
||||
@Transform(({ value }) => value?.toLowerCase())
|
||||
@ApiProperty({ example: 'testuser@email.com' })
|
||||
email!: string;
|
||||
|
||||
|
@ -61,7 +61,9 @@ export class UserController {
|
||||
@ApiBearerAuth()
|
||||
@UseGuards(AdminRolesGuard)
|
||||
@Post()
|
||||
async createUser(@Body(ValidationPipe) createUserDto: CreateUserDto): Promise<UserResponseDto> {
|
||||
async createUser(
|
||||
@Body(new ValidationPipe({ transform: true })) createUserDto: CreateUserDto,
|
||||
): Promise<UserResponseDto> {
|
||||
return await this.userService.createUser(createUserDto);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user