PIN sign-in, because the code could never arrive
── What was actually broken ── The SMS gateway was switched off, and `POST /auth/otp/request` does not fail when that happens: it still answers `sent: true`, still issues a valid 4-digit code, and writes it to the **server log**. So the phone path walked customers to a code screen for a code that could not arrive, and every digit they eventually typed was wrong. The failure read to them as "I entered it wrong". Phone sign-in is now a PIN, which needs no gateway. ── Email still sends codes, so email is untouched ── Email OTP goes over SMTP and works. Deleting a working way in to tidy up a broken one is a net loss for anyone with an email on their account, so "Use email instead" and the code screen stay exactly as they were. `login_otp_guard_test` moves to that path — the `sent: false` guard still matters there, and that is now the only place it can fire. ── One screen, three entrances ── `POST /auth/login` says which of them a number is before anything is asked, so the app never guesses. Guessing is not cosmetic: offer "create a PIN" to a returning customer and the server answers `pin_already_set` on a screen that cannot succeed; offer "enter your PIN" to somebody who has never set one and every attempt is wrong. The separate sign-up screen is deleted rather than hidden. It asked for a name and then sent an SMS code — a second entrance asking the same questions and posting a letter that never lands. A new number now gives its name and PIN on the same screen. ── A second sign-in path found a latent bug ── `AppState.signIn` only started `refreshOrders`, and the OTP screen called `detectPickupLocation` itself afterwards to make up the difference. That held exactly as long as there was one sign-in screen. PIN sign-in did not know about the extra call, so Home opened with no pickup and no serviceable cities. The work belongs to signing in, not to whichever screen happened to be last, so it moved into `signIn` and the OTP screen's copy is gone. ── What the screen deliberately does not do ── It does not greet by name. `POST /auth/login` returns the account holder's name, which tells anybody who types a number who owns it; the field is read but never displayed, so it disappears quietly when the backend drops it. It does not say whether the number or the PIN was wrong — the server answers identically for both on purpose, and narrowing it here would turn sign-in into a way of testing whether a number has an account. "Forgot your PIN?" renders only when a support contact is configured. There is no reset endpoint, so it can only point at a human — and telling somebody locked out that help exists without saying where is worse than silence. ── The handover note does not reach the Miler ── The app said "we pass this to your Miler as a note". It does not: `remarks` reaches the admin console and stops, because the rider app reads a `notes` field per stop that the backend never sends. A customer could hand their parcel to a neighbour believing the Miler had been told. Both screens now say it is recorded on the booking, and that the Miler still calls the account's number. ── Also ── DmTextField gains `obscure`, and PinScreen carries a back button — without one the only correction for a mistyped digit was killing the app.
This commit is contained in:
@@ -41,6 +41,24 @@ class FakeApi extends DoormileApi {
|
||||
/// can make an earlier request land after a later one.
|
||||
final Map<double, (Duration, Place)> geocodes = {};
|
||||
|
||||
// PIN sign-in is not what this file exercises; these satisfy the interface.
|
||||
@override
|
||||
Future<PhoneCheck> checkPhone(String phone) async =>
|
||||
PhoneCheck(phone: phone, registered: false, pinSet: false);
|
||||
|
||||
@override
|
||||
Future<Customer> setPin({
|
||||
required String phone,
|
||||
required String pin,
|
||||
String? name,
|
||||
}) async => Customer(id: 'c', name: name ?? '', phone: phone, email: '');
|
||||
|
||||
@override
|
||||
Future<Customer> verifyPin({
|
||||
required String phone,
|
||||
required String pin,
|
||||
}) async => Customer(id: 'c', name: '', phone: phone, email: '');
|
||||
|
||||
@override
|
||||
Future<BookingLimits> getBookingLimits({Place? pickup}) async {
|
||||
if (limitsError != null) throw limitsError!;
|
||||
|
||||
Reference in New Issue
Block a user