-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.js
More file actions
46 lines (42 loc) · 1.35 KB
/
Copy pathapp.js
File metadata and controls
46 lines (42 loc) · 1.35 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
// PASSWORD VISIBILITY FUNCTION
function myInput() {
let x = document.querySelector('#password')
if (x.type === 'password') {
x.type = 'text'
} else {
x.type = 'password'
}
}
// GET HTML ELEMENT IN JAVASCRIPT
let email = document.querySelector('#email')
let password = document.querySelector('#password')
let form = document.querySelector('form')
// GET REGISRER DATA FROM LOCAL STORAGE
let getLocal = JSON.parse(localStorage.getItem('sendLocal'))
console.log(getLocal);
let emailCheck = getLocal.map(item => {
return item.email
})
form.addEventListener('submit', event => {
event.preventDefault()
getLocal.filter(item => {
if (item.email === email.value && item.password === password.value) {
// alert('Login SuccesFull')
Swal.fire({
title: 'Success!',
text: 'You have successfully logged in!',
icon: 'success',
confirmButtonText: 'Start Quiz'
}).then((result) => {
if (result.isConfirmed) {
window.location = "quiz.html";
}
});
// window.location = 'quiz.html'
} else if (item.email === email.value) {
alert('Password Incorrect!')
} else {
alert('please Register First')
}
})
})