Skip to content

Commit

Permalink
fix : saving user otp
Browse files Browse the repository at this point in the history
  • Loading branch information
ad956 committed Jul 3, 2024
1 parent cd0a43a commit c004efd
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions app/api/auth/login/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,9 @@ async function setOTP(loginBody: LoginBody) {
}

const generatedOTP = generateSecureOTP();
await user.updateOne(
{ email: loginBody.email },
{ $set: { otp: generatedOTP } }
);

user.otp = generatedOTP;
await user.save();

const mailsent = await sendEmail({
to: user.email,
Expand All @@ -72,7 +71,7 @@ async function setOTP(loginBody: LoginBody) {
// retrieves a user from the database based on email and role
async function getUserModel(email: string, role: string) {
const projection = {
_id: 0,
_id: 1,
email: 1,
firstname: 1,
lastname: 1,
Expand Down

0 comments on commit c004efd

Please sign in to comment.