Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix issue #428: Otp column missing issue resolved #429

Merged
merged 3 commits into from
Jan 2, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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) -- Add the otp column to store OTP values
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You have to add default null property in otp column

);

-- Create the info_table
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
Loading