-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathmethods.js
More file actions
27 lines (22 loc) · 797 Bytes
/
methods.js
File metadata and controls
27 lines (22 loc) · 797 Bytes
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
/*****************************************************************************/
/* Server Methods */
/*****************************************************************************/
Meteor.methods({
'server/submitenquiry': function (doc) {
check(doc, {
name: String,
email: String,
phone: Match.Optional(String),
reason: String,
message: String,
"g-recaptcha-response": String
});
var verifyCaptchaResponse = Recaptcha.verifyCaptcha(this.connection.clientAddress, doc['g-recaptcha-response']);
console.dir(verifyCaptchaResponse.data);
if (verifyCaptchaResponse.data.success === false)
throw new Meteor.Error("Oh no! A robot!");
delete doc["g-recaptcha-response"];
Enquiry.insert(doc, function () {
});
}
});