2023-09-17 13:24:39 +02:00
|
|
|
const { validateFields } = require("./validateFields")
|
|
|
|
;(function () {
|
2023-09-24 11:38:03 +02:00
|
|
|
if (context?.data?.formular?.honey) {
|
2023-09-17 13:24:39 +02:00
|
|
|
throw { status: 400, error: "Bot detection" }
|
|
|
|
}
|
|
|
|
delete context.data.formular.honey
|
2023-09-24 11:38:03 +02:00
|
|
|
/**
|
|
|
|
* @type {Array<[string, FormObj]>}
|
|
|
|
*/
|
|
|
|
let values = Object.entries(context?.data?.formular)
|
2023-09-17 13:24:39 +02:00
|
|
|
let validation = validateFields(values)
|
|
|
|
if (validation.length) {
|
|
|
|
throw { status: 400, error: validation }
|
|
|
|
}
|
|
|
|
})()
|