Initial commit
This commit is contained in:
14
api/hooks/forms/post_create.js
Normal file
14
api/hooks/forms/post_create.js
Normal file
@@ -0,0 +1,14 @@
|
||||
const { validateFields } = require("./validateFields")
|
||||
;(function () {
|
||||
if (context.data.formular.honey) {
|
||||
throw { status: 400, error: "Bot detection" }
|
||||
}
|
||||
delete context.data.formular.honey
|
||||
let values = Object.entries(context.data.formular)
|
||||
|
||||
let validation = validateFields(values)
|
||||
console.log(validation)
|
||||
if (validation.length) {
|
||||
throw { status: 400, error: validation }
|
||||
}
|
||||
})()
|
||||
Reference in New Issue
Block a user