allow emails without a tld (#2762)

It's perfectly valid to have an email address without a TLD, for instance:

- test@localhost
- test@svc-in-same-k8s-namespace
- test@internal-corp

Fixes #2667
This commit is contained in:
Thomas
2023-06-14 22:26:17 +01:00
committed by GitHub
parent eed1243263
commit 408fa45c51
8 changed files with 94 additions and 7 deletions

View File

@@ -3,7 +3,7 @@ import { IsEmail, IsNotEmpty, IsOptional, IsString } from 'class-validator';
import { toEmail, toSanitized } from '@app/immich/utils/transform.util';
export class CreateUserDto {
@IsEmail()
@IsEmail({ require_tld: false })
@Transform(toEmail)
email!: string;
@@ -29,7 +29,7 @@ export class CreateAdminDto {
@IsNotEmpty()
isAdmin!: true;
@IsEmail()
@IsEmail({ require_tld: false })
@Transform(({ value }) => value?.toLowerCase())
email!: string;
@@ -44,7 +44,7 @@ export class CreateAdminDto {
}
export class CreateUserOAuthDto {
@IsEmail()
@IsEmail({ require_tld: false })
@Transform(({ value }) => value?.toLowerCase())
email!: string;