aboutsummaryrefslogtreecommitdiff
path: root/bootstrap/comments/frontend/validatecomment.js
blob: a852e81e06f5e9d307fd0e871720916169448fcd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
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;
};