mirror of
https://github.com/strapi/strapi.git
synced 2025-07-26 02:20:32 +00:00
22 lines
553 B
JavaScript
22 lines
553 B
JavaScript
'use strict';
|
|
|
|
const { yup, formatYupErrors } = require('strapi-utils');
|
|
const validators = require('../common-validators');
|
|
|
|
const resetPasswordSchema = yup
|
|
.object()
|
|
.shape({
|
|
resetPasswordToken: yup.string().required(),
|
|
password: validators.password.required(),
|
|
})
|
|
.required()
|
|
.noUnknown();
|
|
|
|
const validateResetPasswordInput = data => {
|
|
return resetPasswordSchema
|
|
.validate(data, { strict: true, abortEarly: false })
|
|
.catch(error => Promise.reject(formatYupErrors(error)));
|
|
};
|
|
|
|
module.exports = validateResetPasswordInput;
|