mirror of
https://github.com/geekgeekrun/geekgeekrun.git
synced 2026-09-07 16:37:06 +08:00
enhance bosszhipin cookie validator
This commit is contained in:
@@ -56,10 +56,16 @@ const formRules = {
|
|||||||
{
|
{
|
||||||
trigger: 'blur',
|
trigger: 'blur',
|
||||||
validator (rule, val, cb) {
|
validator (rule, val, cb) {
|
||||||
|
let arr
|
||||||
try {
|
try {
|
||||||
JSON5.parse(val)
|
arr = JSON5.parse(val)
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
cb(new Error(`JSON content is invalid: ${err.message}`))
|
cb(new Error(`JSON content is invalid: ${err.message}`))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (!Array.isArray(arr) || !arr.length) {
|
||||||
|
cb(new Error(`Invalid cookies. Please copy with EditThisCookie extension`))
|
||||||
|
return
|
||||||
}
|
}
|
||||||
cb()
|
cb()
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user