-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsignUp.js
76 lines (64 loc) · 1.84 KB
/
signUp.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
71
72
73
74
75
76
/*const firstName = document.getElementById("first-name");
const lastName = document.getElementById("last-name");
const email = document.getElementById("email");
const password = document.getElementById("password");
const otpBtn = document.getElementById("otp-btn");
let firstNameValue;
let lastNameValue;
let emailValue;
let passwordValue;
let otpValue;
import config from './config';
const emptyData = () => {
firstNameValue = firstName.value;
lastNameValue = lastName.value;
emailValue = email.value;
passwordValue = password.value;
if (firstNameValue.trim() === "") {
alert("Enter your First Name");
return 0;
}
if (lastNameValue.trim() === "") {
alert("Enter your Last Name");
return 0;
}
if (emailValue.trim() === "") {
alert("Enter your Email")
return 0;
}
if (passwordValue.trim() === "") {
alert("Enter Password");
return 0;
}
return 1;
};
const generateOtp = () => {
const otp = Math.floor((Math.random() * 1000000) + 1);
otpValue = otp;
};
emailjs.init(""); // Initialize with your User ID
const sendEmail = () => {
const templateParams = {
to_the_email: `${emailValue}`,
to_email: `${emailValue}`, // Replace with recipient email
message: `${otpValue}`
};
emailjs.send('', '', templateParams)
.then(response => {
console.log('Email sent successfully!', response.status, response.text);
}, error => {
console.error('Failed to send email:', error);
});
};
otpBtn.addEventListener("click", () => {
if (!emptyData()) {
return;
}
generateOtp();
sendEmail();
localStorage.setItem('OTP', `${otpValue}`);
localStorage.setItem('url', 'signUp.html');
setTimeout(() => {
//window.location.href = "otpVer.html";
}, 100); // Delay in milliseconds
});*/