Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
deleteMessage: translate('Do you really want to delete user?'),
selectTitle: translate('Select user')
};
// need for deep update if local change in any place
static nested = {
groups: Group
};
id: number = undefined;
@IsNotEmpty()
username: string = undefined;
password: string = undefined;
rePassword: string = undefined;
firstName: string = undefined;
lastName: string = undefined;
@IsNotEmpty()
@IsEmail(undefined)
email: string = undefined;
isSuperuser = false;
isStaff = false;
isActive = false;
@Transform(transformStringToDate, { toClassOnly: true })
@Transform(transformDateToString, { toPlainOnly: true })
lastLogin: Date = undefined;
@Transform(transformStringToDate, { toClassOnly: true })
@Transform(transformDateToString, { toPlainOnly: true })
dateJoined: Date = undefined;
@IsOptional()
@Type(serializeModel(Group))
groups: Group[] = [];
@Transform(transformStringToDate, { toClassOnly: true })
@Transform(transformDateToString, { toPlainOnly: true })
dateOfBirth: Date = undefined;
export function IsEmail(
options?: IsEmailOptions,
validationOptions?: ValidationOptions
) {
return classValidator.IsEmail(
options,
Object.assign(
{
message: "must be a valid email address"
},
validationOptions
)
);
}
@IsNotEmpty({
message: strings.siteViewModel.urlIsNotEmptyMessage
})
@IsUrl(undefined, {
message: strings.siteViewModel.urlIsUrlMessage
})
@MaxLength(1000, {
message: strings.siteViewModel.urlMaxLengthMessage
})
public readonly url: string;
@IsNotEmpty({
message: strings.siteViewModel.userNameIsNotEmptyMessage
})
@IsEmail(undefined, {
message: strings.siteViewModel.userNameIsEmailMessage
})
@MaxLength(100, {
message: strings.siteViewModel.userNameMaxLengthMessage
})
public readonly userName: string;
@IsNotEmpty({
message: strings.siteViewModel.passwordIsNotEmptyMessage
})
@MaxLength(100, {
message: strings.siteViewModel.passwordMaxLengthMessage
})
public readonly password: string;
@IsNotEmpty({
export function EmailField(args: EmailFieldOptions = {}): any {
const options = { unique: true, ...decoratorDefaults, ...args };
const factories = [
WarthogField('email', options),
IsEmail(),
Field(),
Column(options) as MethodDecoratorFactory
];
return composeMethodDecorators(...factories);
}
export class AuthModalModel implements IModel {
static strings = {
username: translate('Username'),
email: translate('Email'),
password: translate('Password'),
rePassword: translate('Confirm password')
};
id: number = undefined;
@IsNotEmpty({
groups: [AuthModalTypeEnum.SignUp.toString()]
})
username: string = undefined;
@IsNotEmpty({
groups: [AuthModalTypeEnum.SignIn.toString(), AuthModalTypeEnum.SignUp.toString()]
})
@IsEmail(undefined, {
groups: [AuthModalTypeEnum.SignIn.toString(), AuthModalTypeEnum.SignUp.toString()]
})
email: string = undefined;
@IsNotEmpty({
groups: [AuthModalTypeEnum.SignIn.toString(), AuthModalTypeEnum.SignUp.toString()]
})
password: string = undefined;
@Validate(EqualsToOtherProperty, ['password'], {
groups: [AuthModalTypeEnum.SignUp.toString()]
})
@IsNotEmpty({
groups: [AuthModalTypeEnum.SignUp.toString()]
})
rePassword: string = undefined;
}
import { ExpDepartment } from './exp-department';
export class ExpUser {
id: number;
@IsNotEmpty({
groups: ['user', 'guest']
})
username: string;
@IsNotEmpty({
groups: ['guest']
})
password: string;
@IsEmail(undefined, {
groups: ['user']
})
@IsNotEmpty({
groups: ['user']
})
email: string;
isSuperuser: boolean;
isStaff: boolean;
@ValidateNested({
groups: ['user']
})
@IsOptional({
groups: ['user']