Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main'
Browse files Browse the repository at this point in the history
  • Loading branch information
Nidhi-2408 committed Jan 3, 2025
2 parents f6e3e2c + 4236424 commit 4e82a12
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
3 changes: 2 additions & 1 deletion config/dbQuery.sql
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ CREATE TABLE user_table (
userid INT AUTO_INCREMENT UNIQUE PRIMARY KEY,
username VARCHAR(60) NOT NULL,
email VARCHAR(80) NOT NULL UNIQUE,
password VARCHAR(140) NOT NULL UNIQUE
password VARCHAR(140) NOT NULL UNIQUE,
otp VARCHAR(6) DEFAULT NULL-- Add the otp column to store OTP values
);

-- Create the info_table
Expand Down
2 changes: 1 addition & 1 deletion login-system/login.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ const signup = async (req, res) => {
return res.status(409).send('Username Already in Use');
}
} else {
const sqlInsert = 'INSERT INTO user_table VALUES (0, ?, ?, ?)';
const sqlInsert = 'INSERT INTO user_table VALUES (0, ?, ?, ?, null)';
await connection.query(sqlInsert, [username, email, hashpassword]);
console.log('Created a new User');
const sub = 'Signup-Research Nexas';
Expand Down
3 changes: 2 additions & 1 deletion login-system/otp.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ const sendOtp = async (req, res) => {
let connection;
try {
connection = await connectToDB();
console.log("Connected to the database");

// Search for the user in the database
const sqlSearch = "SELECT * FROM user_table WHERE email = ?";
Expand All @@ -43,7 +44,7 @@ const sendOtp = async (req, res) => {
await connection.query(otpQuery, [verifyCode, email]);

// Send OTP via notification (could be an email or any other method)
// notify(req, res, email, "Email Verification", `This is your OTP to verify your email: ${verifyCode}`);
notify(req, res, email, "Email Verification", `This is your OTP to verify your email: ${verifyCode}`);

return res.send({ message: "OTP sent successfully" });

Expand Down

0 comments on commit 4e82a12

Please sign in to comment.