Advertisement
Guest User

Untitled

a guest
Aug 25th, 2019
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. 'use strict';
  2.  
  3. const Redis = require('ioredis');
  4. const redis = new Redis('cache:6379');
  5.  
  6. const blockList = [
  7. 'blue132@example.com'
  8. ];
  9.  
  10. const badEmailDomains = [
  11. 'hacker.com'
  12. ];
  13.  
  14. const badEmailHandles = [
  15. 'iamahacker'
  16. ];
  17.  
  18. const MINUTES_15 = 60 * 15;
  19.  
  20. async function assertSafe ({ email, ipAddress }) {
  21. const [handle, domain] = email.split('@');
  22. if (blockList.includes(email)) {
  23. throw new Error('ATOStopper: Blocked email');
  24. }
  25.  
  26. if (badEmailHandles.includes(handle)) {
  27. throw new Error('ATOStopper: Blocked email handle');
  28. }
  29.  
  30. if (badEmailDomains.includes(domain)) {
  31. throw new Error('ATOStopper: Blocked email domain');
  32. }
  33. }
  34.  
  35. module.exports = {
  36. assertSafe
  37. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement