shadcn.io is not affiliated with official shadcn/ui
Verify Identity Code Delivery Login Block for React
A verification step that asks where the code should go (text message, email or authenticator app), swaps to the code field once it is sent, and counts a limit of three codes an hour down with every send.
Installation
Overview
Let people choose how they get their code, with this identity verification login block for React with Base UI. It's the verification step of a Mintsend sign-in, money transfers: the page's side rails run the full height and one band crosses the screen, holding a centred column. Three ruled rows of real radio buttons ask where the code should go, each with its destination masked (a number ending 4521, an email address with most of it hidden, your authenticator app). Send code swaps the rows for a six-digit Input OTP, "Code sent to the number ending 4521", and a way back to change the method. A line under both counts how many of the hour's three codes remain; every send takes one, and at none sending is refused with the time the count starts again. The authenticator app sends nothing, so it never takes one. It's built from native radio buttons, Input OTP, Field, Button, Shine Button and Guides, with a CSS entrance only. For any step that offers more than one way to receive a code.
FAQ
What stays in the page, and what is the demo code?
Everything. The code is 358204 for every method, printed once under the field. The destinations are made up and typed into the file, and the hour's count is a number in the page's state that starts at one send already used, so "2 of 3 codes left this hour." is what you see first. Nothing is sent; in a product your server sends the code, keeps the count per account, and answers the same way for an address it doesn't know.
How does the send limit work?
Each text message or email takes one of three codes an hour. The line under the card follows it ("1 of 3 codes left this hour."), and at none it says "No codes left this hour. It starts again at 11:00 UTC." and Send code is refused in words, with the card staying where it is. The reset is a fixed clock time, not a ticking value, so nothing on the page counts down by itself.
Why does the authenticator app not use a send?
Nothing leaves your server for it: the app makes the code from a shared secret and the clock. Choosing it shows "Enter an app code" in place of "Send code", goes to the code field without taking one from the hour's count, and works even when the count is at none, which is the point of offering it.
Why are the destinations masked?
This step comes before sign-in is finished, so the page shouldn't show a full number or address to someone who may not be the owner. The masked forms are enough to recognise your own. Keep the masks the same shape on every account, so they don't reveal how long a name is.
How are the methods chosen with a keyboard?
The three rows are one native radio group: Tab reaches it, the arrow keys move between the rows and choose one, and Enter sends. Each row is a label, so pressing anywhere on it chooses it. Change method returns to the group with focus on the row that was chosen.
Related
- Pro
OTP Verification Login
Codes and approvalsA code step for a parcel locker app: a six-digit field that checks itself on the sixth digit or on a paste, counts wrong codes down from three, and a resend button that waits 30 seconds after it is pressed.
- Pro
Two-Factor Authenticator Login
Codes and approvalsA split sign-in step for an investing app: a six-digit code field beside a demo authenticator whose code and draining ring change every 30 seconds, where the current code and the one before it both sign in.
- Pro
Recovery Email Confirmation Login
Recovery and resetA recovery step for a casual game that shows the address on file masked and asks for the full address before it sends a code, then takes the six-digit code, with a helpdesk note for anyone without access.
- Pro
Push Approval Number Matching Login
Codes and approvalsAn approval step for a freight dashboard: choose Push, Text or Call, send the request and match the number on screen with two demo buttons that play the phone, with a 60-second timer, a wrong-number cancel and an expiry.
- Pro
Phone Auth Login
Codes and approvalsA start-aligned phone sign-in for a carpool app: a country select, a phone field that lays the number out as you type for that country with a length check, then a six-digit code and a signed-in result.
- Pro
Device Approval Login
Codes and approvalsA sign-in screen with a drawn phone: it asks whether the request is you, shows three number buttons, approves the matching one, denies a wrong one and points Deny to a password change.