generate this for me that could met the requirements below:
"If a user logs in from a new or unrecognized device, the system should:
Send a one-time verification code (OTP) via email:
Display a message: ""We've detected a login from a new device. Please enter the verification code sent to your email/phone."""
"The OTP should be 6 digits long (e.g., ""384291"")
Expire after 10 minutes and llow up to 3 incorrect attempts before requiring a new OTP"
"If the correct OTP is entered, the user should be logged in and have an option to “Remember this device”.
"If the wrong OTP is entered 3 times, the system should:
Block further attempts and display: ""Too many failed attempts. Request a new verification code.""
Require the user to request a new OTP"
I'll create a complete solution for a device-based authentication system with OTP verification for new devices. This will include both the frontend components and the backend logic.
This implementation provides a complete device-based authentication system with OTP verification for new devices. Here's how it works:
Login Process:
OTP Verification:
Security Features:
User Experience:
In a production environment, you would:
This implementation meets all the requirements specified in your request while providing a secure and user-friendly experience.