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 #423: Enhance otp function #431

Closed

Conversation

prajwal2431
Copy link
Contributor

@prajwal2431 prajwal2431 commented Jan 3, 2025

📋 Description

Fix Issue #423

This PR introduces several key improvements, including the addition of an OTP generator module with automatic OTP generation, the implementation of OTP expiration functionality, and the integration of a timer in the UI to show remaining OTP validity. Additionally, the PR resolves an issue with the /resetpassword endpoint, renaming it to /reset. It also addresses a bug where repeated OTPs were sent in quick succession by implementing rate-limiting logic.

🔨 Changes Made

  • Added an OTP generator module for automatic OTP generation.
  • Implemented OTP expiration functionality to restrict OTP validity to a specific time period.
  • Integrated a timer in the UI to display the remaining time before OTP expiration.
  • Resolved the /resetpassword endpoint issue by renaming it to /reset to follow proper naming conventions.
  • Fixed database issues related to OTP generation and expiration, ensuring smooth functionality under extreme conditions.
  • Prevented repeated OTP sending by introducing rate-limiting logic.

✅ Checklist

Before submitting the PR, please make sure you have completed the following:

  • I have followed all the guidelines mentioned in CONTRIBUTING.md.
  • My code follows the style guidelines of this project.
  • I have performed a self-review of my own code.
  • I have commented my code, particularly in hard-to-understand areas.
  • I have made corresponding changes to the documentation (if applicable).
  • I have tested it locally and it works fine.
  • Any dependent changes have been merged and published in downstream modules.

🏷️ Types of Changes

What type of changes does your code introduce? (Check all that apply)

  • Bug fix (non-breaking change which fixes an issue) 🐛
  • [] New feature (non-breaking change which adds functionality) ✨
  • UI enhancement (non-breaking change which enhances UI) 🎨
  • Documentation update 📚

Fixes #423

📸 Screenshots (if applicable)

Screenshot 2025-01-03 170648


Thank you for contributing to Research Nexus! We look forward to reviewing your PR and getting it merged!

Copy link
Member

@Harshdev098 Harshdev098 left a comment

Choose a reason for hiding this comment

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

Don't save the expiry time of the otp in database instead use MySQL Events to delete the otp data for that user, it will be efficient
You can update the logic you have written in login.js and otp.js, also you have modified the reset endpoint but didn't modified it in dbServer.js.
Also you can do one thing in frontend: fix the send validation code btn just below to the email input

@prajwal2431
Copy link
Contributor Author

Yeah sure

@prajwal2431
Copy link
Contributor Author

I don't understand the purpose of frontend development or what I'm supposed to do.

@Harshdev098
Copy link
Member

Actually I am telling that the send verification code btn should be below to the email input field and verification code input field should be below to the send verification button.
That's all

@prajwal2431
Copy link
Contributor Author

ohk will do that

@prajwal2431
Copy link
Contributor Author

Should I create a SQL event for OTP expiration and add the otp_created column as well? or you have any other idea in mind regarding this?

@prajwal2431
Copy link
Contributor Author

or Should I use Otp_expiration as a variable?

@Harshdev098
Copy link
Member

You can store the otp in the database but does not store the otp expiration time it can be done with MySQL events

@prajwal2431
Copy link
Contributor Author

there is a issue in the last commit but i cant revert back to this i dont know why and even i cant make up the changes there is lot of issue in previous commit

@Harshdev098
Copy link
Member

@prajwal2431 Ok no problem
Have you registered on oslead application. I have to give points on contribution

@prajwal2431
Copy link
Contributor Author

yess i have

@prajwal2431
Copy link
Contributor Author

can i do like create a new branch and then make pr again and you can delete or discard this pr

@Harshdev098
Copy link
Member

can i do like create a new branch and then make pr again and you can delete or discard this pr

Sure, close it if you want

@prajwal2431
Copy link
Contributor Author

what the problem is i have the same branch but these changes are not refeting on this pr i dont know why
and i have these changes on my local but i even if i push it says up to date so will make a new pr

@prajwal2431 prajwal2431 closed this Jan 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Improving The OTP functionality
2 participants