diff options
Diffstat (limited to 'bootstrap/comments/frontend/validatecomment.js')
-rw-r--r-- | bootstrap/comments/frontend/validatecomment.js | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/bootstrap/comments/frontend/validatecomment.js b/bootstrap/comments/frontend/validatecomment.js new file mode 100644 index 0000000..a852e81 --- /dev/null +++ b/bootstrap/comments/frontend/validatecomment.js @@ -0,0 +1,28 @@ +// Validate required comment credentials (validatecomment.js) +HashOver.prototype.validateComment = function (skipComment, form, type, permalink, isReply, isEdit) +{ + skipComment = skipComment || false; + type = type || 'main'; + permalink = permalink || null; + isReply = isReply || false; + isEdit = isEdit || false; + + // Validate comment form + var message = this.commentValidator (form, skipComment, isReply); + + // Display the validator's message + if (message !== true) { + this.messages.show (message, type, permalink, true, isReply, isEdit); + return false; + } + + // Validate e-mail if user isn't logged in or is editing + if (this.setup['user-is-logged-in'] === false || isEdit === true) { + // Return false on any failure + if (this.validateEmail (type, permalink, form, isReply, isEdit) === false) { + return false; + } + } + + return true; +}; |