-
Notifications
You must be signed in to change notification settings - Fork 39
/
domains.js
70 lines (64 loc) · 1.72 KB
/
domains.js
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
/*jshint esversion:6*/
/*
Adding an entry into the `approvedDomains` array below works as a postfix so any email domain ending with a postfix can then be invited through the bot.
For example, the main entry below is `gov.uk` allowing @agency.gov.uk, @department.gov.uk or @something.executiveagency.gov.uk to be invite-able through the bot. Another example would be `police.uk`, which allows @force1.police.uk and @force2.police.uk.
*/
var approvedDomains = [
'gov.uk',
'gov.scot',
'acas.org.uk',
'awe.co.uk',
'bankofengland.co.uk',
'biglotteryfund.org.uk',
'bl.uk',
'bmtdsl.co.uk',
'caa.co.uk',
'cqc.org.uk',
'ddc-mod.org',
'digital.nhs.uk',
'electoralcommission.org.uk',
'hee.nhs.uk',
'heritagefund.org.uk',
'hes.scot',
'highwaysengland.co.uk',
'hlf.org.uk',
'hmcts.net',
'hs2.org.uk',
'jncc.gov.uk',
'judicialappointments.digital',
'leadershipacademy.nhs.uk',
'llyw.cymru',
'marinemanagement.org.uk',
'mod.uk',
'naturalengland.org.uk',
'nature.scot',
'nhs.net',
'nhsbt.nhs.uk',
'nhsx.nhs.uk',
'nice.org.uk',
'os.uk',
'parliament.scot',
'parliament.uk',
'police.uk',
'scotent.co.uk',
'sepa.org.uk',
'slc.co.uk',
'socialcare.wales',
'stfc.ac.uk',
'tnlcommunityfund.org.uk',
'tfwm.org.uk',
'transportforthenorth.com',
'wiltonpark.org.uk',
'wmca.org.uk',
'ukri.org'
]
function hasApprovedEmail(email) {
return approvedDomains.reduce(function(previous, domain) {
return previous || email.endsWith('.' + domain) || email.endsWith('@' + domain);
}, false);
}
function approvedDomainsString() {
return approvedDomains.slice().sort().join(', ');
}
module.exports.hasApprovedEmail = hasApprovedEmail;
module.exports.approvedDomainsString = approvedDomainsString;