From ce4d15dda5c8e74a70e3e77f2fd2f0d6d0d6c982 Mon Sep 17 00:00:00 2001 From: "Mr. X" Date: Tue, 21 Apr 2020 21:10:43 +0800 Subject: [PATCH] =?UTF-8?q?=E6=98=B5=E7=A7=B0=E5=92=8C=E9=82=AE=E7=AE=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 如果您希望保留匿名评论的选择,建议开放一个参数,让站长可以选择是否要求填写昵称和邮箱。 如果必须填写昵称和邮箱,则昵称至少3个字符,邮箱至少6个字符且必须包含`@`和`.` > 例如 `a@t.io` 这已经是邮箱的最短结构了 --- src/index.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/index.js b/src/index.js index 500157c4..64370915 100644 --- a/src/index.js +++ b/src/index.js @@ -843,6 +843,14 @@ ValineFactory.prototype.bind = function (option) { }) return; } + if (defaultComment['nick'].length < 3) { + inputs['nick'].focus(); + return; + } + if (defaultComment['mail'].length < 6 || defaultComment['mail'].indexOf('@') < 1 || defaultComment['mail'].indexOf('.') < 3) { + inputs['mail'].focus(); + return; + } if (defaultComment['comment'] == '') { inputs['comment'].focus(); return; @@ -1066,4 +1074,4 @@ function Valine(options) { } module.exports = Valine; -module.exports.default = Valine; \ No newline at end of file +module.exports.default = Valine;