shadcn.io is not affiliated with official shadcn/ui
Location Verification Login Block for React
A split sign-in page that asks whether a sign-in from far away was you: a drawn map with two places and an arc, a list of facts, and two answers, This is me and Not me.
Installation
Overview
Ask before you trust a sign-in from somewhere new, with this location verification login block for React with Base UI. It's the "was this you?" step of Roamfern, a travel planner: a whole screen with the page's rails and one band across it, the decision at the end and a framed map at the start on wide screens. The decision is a header asking whether the sign-in from Los Angeles was yours, a list of facts (the new place, the usual place, how far apart they are, the network address and the time) and two buttons: the one Shine Button, This is me, and an outline Button, Not me. The map is a greyscale drawing with grid lines, a dashed arc, a solid dot for the usual place and a ringed one for the new place, with the distance on the arc and + marks on the corners from Guides. Either answer waits a moment and then shows what a real product would do, in the decision's own space, with a way back. It's built from Button, Shine Button and Guides, with a CSS entrance only. For sign-ins that compare where someone is with where they usually are.
FAQ
What stays in the page, and how do I wire it for real?
Everything. The places, the distance, the time and the network address (an address from a range reserved for documentation) are typed text; the answers wait 600 milliseconds and change the page's state, and nothing is stored or sent. This block never asks the browser for your location. In a product the check runs on your server, from the network address of the request, so nobody is asked for permission: look the address up in a coarse location database, compare it with the places the account usually signs in from, and ask this question only when the distance is large.
What do the two answers do?
This is me says Roamfern would remember the place for 30 days, and Not me says it would block the sign-in and email a password reset; in this demo nothing is remembered or sent, and the result says so. Both take the decision's place in the same space, move focus to the result heading, and leave a Start over button that returns focus to This is me.
Is the map real, and what happens on a phone?
No, it's a fictional drawing, labelled as not to scale; the places and the distance are typed. It's hidden below the large breakpoint because a phone's first screen belongs to the question, and the list of facts says the same things in words, so nothing is lost.
Why is the decision first in the page when the map is first on screen?
Because reading order should follow importance. The question and its buttons come first in the markup, so keyboard and screen reader users meet them before the picture; on wide screens the map is placed at the start of the band with grid placement only.
Where does the distance come from?
It's a typed figure, About 2,590 mi, roughly the great-circle distance between the two city centres, written as a constant so the page never changes. In a product, compute it on the server from the two coarse locations and round it, so you never imply precision your location data does not have.
Related
- 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.
- Pro
Suspicious Activity Login
Risk checksA page that reports a blocked sign-in after the fact: an incident timeline of three events, the facts of the attempt, then Secure my account (which asks for the password) or This was me.
- Pro
Risk Assessment Login
Risk checksA sign-in page that shows why it is asking: six weighted signals add up to a score, a three-zone band marks it, and the question follows the zone: nothing, a six-digit code, or a block.
- Pro
A network check for a sign-in: type an IPv4 address and real CIDR maths says which of three allowed ranges holds it, then either continues or asks for access with a reason.
- Pro
Trust Score Login
Risk checksA sign-in score simulator: four demo switches fill a circular meter in steps of 25 and decide the check, none above 75, a code from 50, an approval below, with a sketch of that check.
- Pro
Remember Device Login
Sessions and devicesA full-height sign-in page for an email client where trusting the browser is a choice with a consequence: a switch opens a 7, 30 or 90 day choice and a live line works out the date from a typed today.