Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 'use strict';
- const Redis = require('ioredis');
- const redis = new Redis('cache:6379');
- const blockList = [
- 'blue132@example.com'
- ];
- const badEmailDomains = [
- 'hacker.com'
- ];
- const badEmailHandles = [
- 'iamahacker'
- ];
- const MINUTES_15 = 60 * 15;
- async function assertSafe ({ email, ipAddress }) {
- const [handle, domain] = email.split('@');
- if (blockList.includes(email)) {
- throw new Error('ATOStopper: Blocked email');
- }
- if (badEmailHandles.includes(handle)) {
- throw new Error('ATOStopper: Blocked email handle');
- }
- if (badEmailDomains.includes(domain)) {
- throw new Error('ATOStopper: Blocked email domain');
- }
- }
- module.exports = {
- assertSafe
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement