-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsecurity.js
More file actions
123 lines (121 loc) · 3.89 KB
/
security.js
File metadata and controls
123 lines (121 loc) · 3.89 KB
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
const fs = require('fs');
const settings = JSON.parse(fs.readFileSync('settings.json'));
module.exports = {
test: function () {
let settingsComply = true;
let errors = '';
//EcoleDirecte settings
if (
settings.main.language === '' ||
settings.main.language == undefined ||
typeof settings.main.language != 'string'
) {
settingsComply = false;
errors +=
"\n No language setting found, make sure it is set and it's a recognised abreviation, see README";
}
if (
settings.ecoleDirecte.user === '' ||
settings.ecoleDirecte.user == undefined ||
typeof settings.ecoleDirecte.user != 'string'
) {
settingsComply = false;
errors += '\n No EcoleDirecte user, must also be string';
}
if (
settings.ecoleDirecte.pass === '' ||
settings.ecoleDirecte.pass == undefined ||
typeof settings.ecoleDirecte.pass != 'string'
) {
settingsComply = false;
errors += '\n No EcoleDirecte password, must also be string';
}
//"DaMail" settings
if (
settings.daMail.from === '' ||
settings.daMail.from == undefined ||
typeof settings.daMail.from != 'string'
) {
settingsComply = false;
errors += '\n No email adress as sender, muake sure it is a string';
}
if (
settings.daMail.to === '' ||
settings.daMail.to == undefined ||
typeof settings.daMail.to != 'string'
) {
settingsComplyecoleDirecte = false;
errors += '\n No email adress as receiver, might not be a string';
}
if (
settings.daMail.subject == undefined ||
typeof settings.daMail.subject != 'string'
) {
settingsComply = false;
errors +=
'\n No subject for the email, could be undefined or not a string';
}
//transporter settings
if (
settings.transporterInformation.host === '' ||
settings.transporterInformation.host == undefined ||
typeof settings.transporterInformation.host !== 'string'
) {
settingsComply = false;
errors +=
"\n No host to send email through, maybe wasn't in settings.json, maybe wasn't a string";
}
if (
settings.transporterInformation.port === 0 ||
settings.transporterInformation.port == undefined ||
typeof settings.transporterInformation.port !== 'number'
) {
settingsComply = false;
errors += '\n No valid port, must be an int';
}
if (
settings.transporterInformation.secure == undefined ||
typeof settings.transporterInformation.secure !== 'boolean'
) {
settingsComply = false;
errors +=
'\n Lacks security information, must be boolean (true or false)';
}
//transporter auth settings
if (
settings.transporterInformation.auth.user === '' ||
settings.transporterInformation.auth.user == undefined ||
typeof settings.transporterInformation.auth.user != 'string'
) {
settingsComply = false;
errors +=
'\n You probably forgot to put in a user for your email transporter information';
}
if (
settings.transporterInformation.auth.pass === '' ||
settings.transporterInformation.auth.pass == undefined ||
typeof settings.transporterInformation.auth.pass != 'string'
) {
settingsComply = false;
errors +=
'\n It seems there is no password to connect to the transporter';
}
//scheduling settings
if (
settings.scheduling.hour == undefined ||
typeof settings.scheduling.hour !== 'number'
) {
settingsComply = false;
errors +=
"\n The hour you have set doesn't comply with format, must be an int";
}
if (
settings.scheduling.minute == undefined ||
typeof settings.scheduling.minute !== 'number'
) {
settingsComply = false;
errors += '\n The minute you have set must be an int';
}
return [settingsComply, errors];
},
};