wip wiring up account forms
This commit is contained in:
parent
cdc15f019d
commit
3459bf26f8
25 changed files with 413 additions and 53 deletions
18
imports/modules/rate-limit.js
Normal file
18
imports/modules/rate-limit.js
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
import { Meteor } from 'meteor/meteor';
|
||||
import { DDPRateLimiter } from 'meteor/ddp-rate-limiter';
|
||||
import { _ } from 'meteor/underscore';
|
||||
|
||||
const fetchMethodNames = methods => _.pluck(methods, 'name');
|
||||
|
||||
const assignLimits = ({ methods, limit, timeRange }) => {
|
||||
const methodNames = fetchMethodNames(methods);
|
||||
|
||||
if (Meteor.isServer) {
|
||||
DDPRateLimiter.addRule({
|
||||
name(name) { return _.contains(methodNames, name); },
|
||||
connectionId() { return true; },
|
||||
}, limit, timeRange);
|
||||
}
|
||||
};
|
||||
|
||||
export default function rateLimit(options) { return assignLimits(options); }
|
||||
Loading…
Add table
Add a link
Reference in a new issue