-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathabout_you.js
58 lines (52 loc) · 1.81 KB
/
about_you.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
const form_submit = document.querySelector('form');
form_submit.addEventListener('submit', (e) => {
e.preventDefault();
var username = form_submit.username.value.toString().toLowerCase();
var password = form_submit.password.value
const authenticated = authentication(username, password);
if (authenticated === true) {
const scriptURL = 'https://script.google.com/macros/s/AKfycbxgkUzEh7JuXeGpipQSdFrw7T_Sx-ooe7RL6TEf099acMGR6OL72tkjgxf0CzLyHHW0-g/exec'
const form = document.forms['submit-to-google-sheet']
form.addEventListener('submit', (e) => {
fetch(scriptURL, { method: 'POST', body: new FormData(form) })
.then(response => console.log('Success!', response))
.catch(error => console.error('Error!', error.message))
})
}
else {
alert('wrong password')
}
})
var chudail_password = 'chudail_26';
var penguin_password = 'penguin_08';
var kritika_password = 'kritika_14';
var ayush_password = 'ayush_25';
var shlok_password = 'shlok_19';
var sakhsi_password = 'sakshi_24';
var bala_password = 'bala_09';
function authentication(username, password) {
if (username === 'chudail' && password === chudail_password) {
return true;
}
if (username === 'penguin' && password === penguin_password) {
return true;
}
if (username === 'kritika' && password === kritika_password) {
return true;
}
if (username === 'ayush' && password === ayush_password) {
return true;
}
if (username === 'shlok' && password === shlok_password) {
return true;
}
if (username === 'sakshi' && password === sakhsi_password) {
return true;
}
if (username === 'bala' && password === bala_password) {
return true;
}
else {
return false
}
}