vue-honeypot
Version:
A simple honeypot component for Vue.js.
57 lines (56 loc) • 1.17 kB
JavaScript
import { openBlock as r, createElementBlock as d, withDirectives as p, createElementVNode as i, vModelText as u } from "vue";
const c = (e, t) => {
const o = e.__vccOpts || e;
for (const [l, a] of t)
o[l] = a;
return o;
}, f = {
data: () => ({ value: "" }),
methods: {
validate() {
if (this.value)
throw new Error(
"Looks like you are a bot. You have filled out the legendary honeypot field!"
);
}
}
}, h = { style: {
position: "absolute",
top: 0,
left: 0,
zIndex: -1,
width: 0,
height: 0,
opacity: 0
} }, m = /* @__PURE__ */ i(
"span",
null,
"Name",
-1
/* HOISTED */
);
function v(e, t, o, l, a, y) {
return r(), d("label", h, [
m,
p(i(
"input",
{
"onUpdate:modelValue": t[0] || (t[0] = (s) => e.value = s),
autocomplete: "off",
tabindex: "-1",
type: "text"
},
null,
512
/* NEED_PATCH */
), [
[u, e.value]
])
]);
}
const n = /* @__PURE__ */ c(f, [["render", v]]);
n.install = (e) => e.component("VueHoneypot", n);
typeof window < "u" && (window.VueHoneypot = n);
export {
n as default
};