Software: Apache/2.4.41 (Ubuntu). PHP/8.0.30 uname -a: Linux apirnd 5.4.0-204-generic #224-Ubuntu SMP Thu Dec 5 13:38:28 UTC 2024 x86_64 uid=33(www-data) gid=33(www-data) groups=33(www-data) Safe-mode: OFF (not secure) /var/www/html/wincloud_gateway/node_modules/strapi-admin/validation/ drwxr-xr-x | |
| Viewing file: Select action/file-type: 'use strict';
const { yup, formatYupErrors } = require('strapi-utils');
const validators = require('./common-validators');
const handleReject = error => Promise.reject(formatYupErrors(error));
const userCreationSchema = yup
.object()
.shape({
email: validators.email.required(),
firstname: validators.firstname.required(),
lastname: validators.lastname.required(),
roles: validators.roles.min(1),
preferedLanguage: yup.string().nullable(),
})
.noUnknown();
const validateUserCreationInput = data => {
return userCreationSchema.validate(data, { strict: true, abortEarly: false }).catch(handleReject);
};
const profileUpdateSchema = yup
.object()
.shape({
email: validators.email.notNull(),
firstname: validators.firstname.notNull(),
lastname: validators.lastname.notNull(),
username: validators.username.nullable(),
password: validators.password.notNull(),
preferedLanguage: yup.string().nullable(),
})
.noUnknown();
const validateProfileUpdateInput = data => {
return profileUpdateSchema
.validate(data, { strict: true, abortEarly: false })
.catch(handleReject);
};
const userUpdateSchema = yup
.object()
.shape({
email: validators.email.notNull(),
firstname: validators.firstname.notNull(),
lastname: validators.lastname.notNull(),
username: validators.username.nullable(),
password: validators.password.notNull(),
isActive: yup.bool().notNull(),
roles: validators.roles.min(1).notNull(),
})
.noUnknown();
const validateUserUpdateInput = data => {
return userUpdateSchema.validate(data, { strict: true, abortEarly: false }).catch(handleReject);
};
const usersDeleteSchema = yup
.object()
.shape({
ids: yup
.array()
.of(yup.strapiID())
.min(1)
.required(),
})
.noUnknown();
const validateUsersDeleteInput = async data => {
return usersDeleteSchema.validate(data, { strict: true, abortEarly: false }).catch(handleReject);
};
module.exports = {
validateUserCreationInput,
validateProfileUpdateInput,
validateUserUpdateInput,
validateUsersDeleteInput,
schemas: {
userCreationSchema,
usersDeleteSchema,
userUpdateSchema,
},
};
|
:: Command execute :: | |
--[ c99shell v. 2.5 [PHP 8 Update] [24.05.2025] | Generation time: 0.0049 ]-- |