fileserver/dto/src/requests/auth.ts

47 lines
719 B
TypeScript
Raw Normal View History

2022-08-25 11:39:58 +00:00
import { BaseRequest } from './base';
2022-08-25 13:13:44 +00:00
import {
IsBoolean,
IsEmail,
IsNotEmpty,
IsOptional,
IsString
} from 'class-validator';
2022-08-25 11:39:58 +00:00
2022-08-25 13:13:44 +00:00
export class SignUpRequest extends BaseRequest {
2022-08-25 11:39:58 +00:00
@IsEmail()
username: string;
@IsNotEmpty()
2022-08-25 13:13:44 +00:00
@IsString()
2022-08-25 11:39:58 +00:00
password: string;
}
2022-08-25 13:13:44 +00:00
export class LoginRequest extends SignUpRequest {
@IsOptional()
@IsNotEmpty()
@IsString()
2022-08-25 11:39:58 +00:00
otp?: string;
}
2022-08-25 13:13:44 +00:00
export class TfaComplete extends BaseRequest {
@IsNotEmpty()
@IsString()
code: string;
}
export class TfaSetup extends BaseRequest {
@IsNotEmpty()
@IsBoolean()
mail: boolean;
}
2022-08-25 11:27:47 +00:00
export class ChangePasswordRequest extends BaseRequest {
@IsNotEmpty()
@IsString()
oldPassword: string;
@IsNotEmpty()
@IsString()
newPassword: string;
}