- added backup codes for 2 factor authentication
Some checks failed
CI Pipeline / japa-tests (push) Failing after 58s
Some checks failed
CI Pipeline / japa-tests (push) Failing after 58s
- npm updates - coverage validation: elevation ust be positive, depth must be negative - vinejs-provider.js: get enabled extensions from database, not via validOptions.extnames - vue components for backup codes: e.g.: PersonalSettings.vue - validate spaital coverage in leaflet map: draw.component.vue, map.component.vue - add backup code authentication into Login.vue - preset to use no preferred reviewer: Release.vue - 2 new vinejs validation rules: file_scan.ts and file-length.ts
This commit is contained in:
parent
ac473b1e72
commit
005df2e454
32 changed files with 1416 additions and 526 deletions
|
@ -4,9 +4,11 @@ import dayjs from 'dayjs';
|
|||
import MimeType from '#models/mime_type';
|
||||
|
||||
const enabledExtensions = await MimeType.query().select('file_extension').where('enabled', true).exec();
|
||||
const extensions = enabledExtensions.map((extension)=> {
|
||||
return extension.file_extension.split('|')
|
||||
}).flat();
|
||||
const extensions = enabledExtensions
|
||||
.map((extension) => {
|
||||
return extension.file_extension.split('|');
|
||||
})
|
||||
.flat();
|
||||
|
||||
/**
|
||||
* Validates the dataset's creation action
|
||||
|
@ -55,7 +57,13 @@ export const createDatasetValidator = vine.compile(
|
|||
authors: vine
|
||||
.array(
|
||||
vine.object({
|
||||
email: vine.string().trim().maxLength(255).email().normalizeEmail().isUniquePerson({ table: 'persons', column: 'email', idField: 'id' }),
|
||||
email: vine
|
||||
.string()
|
||||
.trim()
|
||||
.maxLength(255)
|
||||
.email()
|
||||
.normalizeEmail()
|
||||
.isUniquePerson({ table: 'persons', column: 'email', idField: 'id' }),
|
||||
first_name: vine.string().trim().minLength(3).maxLength(255),
|
||||
last_name: vine.string().trim().minLength(3).maxLength(255),
|
||||
}),
|
||||
|
@ -65,14 +73,20 @@ export const createDatasetValidator = vine.compile(
|
|||
contributors: vine
|
||||
.array(
|
||||
vine.object({
|
||||
email: vine.string().trim().maxLength(255).email().normalizeEmail().isUniquePerson({ table: 'persons', column: 'email', idField: 'id' }),
|
||||
email: vine
|
||||
.string()
|
||||
.trim()
|
||||
.maxLength(255)
|
||||
.email()
|
||||
.normalizeEmail()
|
||||
.isUniquePerson({ table: 'persons', column: 'email', idField: 'id' }),
|
||||
first_name: vine.string().trim().minLength(3).maxLength(255),
|
||||
last_name: vine.string().trim().minLength(3).maxLength(255),
|
||||
pivot_contributor_type: vine.enum(Object.keys(ContributorTypes)),
|
||||
}),
|
||||
)
|
||||
.distinct('email')
|
||||
.optional(),
|
||||
.optional(),
|
||||
// third step
|
||||
project_id: vine.number().optional(),
|
||||
// embargo_date: schema.date.optional({ format: 'yyyy-MM-dd' }, [rules.after(10, 'days')]),
|
||||
|
@ -89,13 +103,13 @@ export const createDatasetValidator = vine.compile(
|
|||
x_max: vine.number(),
|
||||
y_min: vine.number(),
|
||||
y_max: vine.number(),
|
||||
elevation_absolut: vine.number().optional(),
|
||||
elevation_min: vine.number().optional().requiredIfExists('elevation_max'),
|
||||
elevation_max: vine.number().optional().requiredIfExists('elevation_min'),
|
||||
elevation_absolut: vine.number().positive().optional(),
|
||||
elevation_min: vine.number().positive().optional().requiredIfExists('elevation_max'),
|
||||
elevation_max: vine.number().positive().optional().requiredIfExists('elevation_min'),
|
||||
// type: vine.enum(Object.values(DescriptionTypes)),
|
||||
depth_absolut: vine.number().optional(),
|
||||
depth_min: vine.number().optional().requiredIfExists('depth_max'),
|
||||
depth_max: vine.number().optional().requiredIfExists('depth_min'),
|
||||
depth_absolut: vine.number().negative().optional(),
|
||||
depth_min: vine.number().negative().optional().requiredIfExists('depth_max'),
|
||||
depth_max: vine.number().negative().optional().requiredIfExists('depth_min'),
|
||||
}),
|
||||
references: vine
|
||||
.array(
|
||||
|
@ -120,10 +134,13 @@ export const createDatasetValidator = vine.compile(
|
|||
// last step
|
||||
files: vine
|
||||
.array(
|
||||
vine.myfile({
|
||||
size: '512mb',
|
||||
extnames: extensions,
|
||||
}).filenameLength({ clientNameSizeLimit : 100 }),
|
||||
vine
|
||||
.myfile({
|
||||
size: '512mb',
|
||||
extnames: extensions,
|
||||
})
|
||||
.filenameLength({ clientNameSizeLimit: 100 })
|
||||
.fileScan({ removeInfected: true }),
|
||||
)
|
||||
.minLength(1),
|
||||
}),
|
||||
|
@ -175,7 +192,13 @@ export const updateDatasetValidator = vine.compile(
|
|||
authors: vine
|
||||
.array(
|
||||
vine.object({
|
||||
email: vine.string().trim().maxLength(255).email().normalizeEmail().isUniquePerson({ table: 'persons', column: 'email', idField: 'id' }),
|
||||
email: vine
|
||||
.string()
|
||||
.trim()
|
||||
.maxLength(255)
|
||||
.email()
|
||||
.normalizeEmail()
|
||||
.isUniquePerson({ table: 'persons', column: 'email', idField: 'id' }),
|
||||
first_name: vine.string().trim().minLength(3).maxLength(255),
|
||||
last_name: vine.string().trim().minLength(3).maxLength(255),
|
||||
}),
|
||||
|
@ -185,7 +208,13 @@ export const updateDatasetValidator = vine.compile(
|
|||
contributors: vine
|
||||
.array(
|
||||
vine.object({
|
||||
email: vine.string().trim().maxLength(255).email().normalizeEmail().isUniquePerson({ table: 'persons', column: 'email', idField: 'id' }),
|
||||
email: vine
|
||||
.string()
|
||||
.trim()
|
||||
.maxLength(255)
|
||||
.email()
|
||||
.normalizeEmail()
|
||||
.isUniquePerson({ table: 'persons', column: 'email', idField: 'id' }),
|
||||
first_name: vine.string().trim().minLength(3).maxLength(255),
|
||||
last_name: vine.string().trim().minLength(3).maxLength(255),
|
||||
pivot_contributor_type: vine.enum(Object.keys(ContributorTypes)),
|
||||
|
@ -209,13 +238,13 @@ export const updateDatasetValidator = vine.compile(
|
|||
x_max: vine.number(),
|
||||
y_min: vine.number(),
|
||||
y_max: vine.number(),
|
||||
elevation_absolut: vine.number().optional(),
|
||||
elevation_min: vine.number().optional().requiredIfExists('elevation_max'),
|
||||
elevation_max: vine.number().optional().requiredIfExists('elevation_min'),
|
||||
elevation_absolut: vine.number().positive().optional(),
|
||||
elevation_min: vine.number().positive().optional().requiredIfExists('elevation_max'),
|
||||
elevation_max: vine.number().positive().optional().requiredIfExists('elevation_min'),
|
||||
// type: vine.enum(Object.values(DescriptionTypes)),
|
||||
depth_absolut: vine.number().optional(),
|
||||
depth_min: vine.number().optional().requiredIfExists('depth_max'),
|
||||
depth_max: vine.number().optional().requiredIfExists('depth_min'),
|
||||
depth_absolut: vine.number().negative().optional(),
|
||||
depth_min: vine.number().negative().optional().requiredIfExists('depth_max'),
|
||||
depth_max: vine.number().negative().optional().requiredIfExists('depth_min'),
|
||||
}),
|
||||
references: vine
|
||||
.array(
|
||||
|
@ -238,14 +267,13 @@ export const updateDatasetValidator = vine.compile(
|
|||
.minLength(3)
|
||||
.distinct('value'),
|
||||
// last step
|
||||
files: vine
|
||||
.array(
|
||||
vine.myfile({
|
||||
size: '512mb',
|
||||
extnames: extensions,
|
||||
}),
|
||||
),
|
||||
// .minLength(1),
|
||||
files: vine.array(
|
||||
vine.myfile({
|
||||
size: '512mb',
|
||||
extnames: extensions,
|
||||
}),
|
||||
),
|
||||
// .minLength(1),
|
||||
}),
|
||||
);
|
||||
|
||||
|
|
Loading…
Add table
editor.link_modal.header
Reference in a new issue