Registration: a refused submit fetches a fresh form before the next one #32
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/registration-captcha"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Fixes #31
The error alert's OK returned to the same registration form after the server refused a submit. ejabberd deletes the XEP-0158 challenge on the first check whatever the verdict, so submitting that form again always failed with "The CAPTCHA verification has failed" and hid the real reason ("User already exists", one registration per IP per 600 s on another.im, …).
RegistrationViewModel: an<Error>that answers a submit (phase == .submitting) setsformSpent.dismissError()then callsretry()(freshregister connectwith the same token, typed answers put back) instead of going back to.readyon the spent form.connect()andcancel()clear the flag.Testing. I checked the behaviour on libtacky's ejabberd 26.09 rig (captcha_pow only, as production), driving
registerthe way this view model does:The CAPTCHA verification has failed;<Success>;<Success>;<Success>.This Swift change was not compiled or run. There is no Xcode on the machine where it was written. It is small and reads as type-correct against the surrounding code, but please build it and try it on a device: register with a taken name, tap OK, change the name, then Register. It should succeed, or show the server's real reason.
🤖 Generated with Claude Code
The user (2026-11-07): sign-up on iOS ends in "The CAPTCHA verification has failed". ejabberd 26.09 checks the XEP-0158 challenge before anything else and deletes it whatever the verdict (ejabberd_captcha check_captcha_pow), so once a submit is refused for another reason ("User already exists", one registration per IP per 600 s on another.im, a malformed name) the form behind it is spent. The error alert's OK put the view model back to .ready on that same form, and the next Create sent it again: libtacky solved a new proof of work for a challenge the server no longer has, and every further attempt got the CAPTCHA text instead of the real reason. Reproduced on libtacky's ejabberd rig driving register exactly as this view model does. A submit's <Error> now marks the form spent, and dismissing the error fetches a fresh form (retry: same token, answers typed kept), as the alert's Retry already did. Not compiled here (no Xcode on this machine). Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>Correction to what I wrote here at first:
feat/ui-redesigndoes fail with this text, from another cause. ItsRegistrationModel.submitsent every hidden field since5b49046e,SHA-256among them; libtacky hands the proof-of-work field out as hidden and solves it only when that key is not among the values (register.tclSubmit), so on another.im (captcha_pow) every submit, the first included, went with an empty hash and got "The CAPTCHA verification has failed", and Try again failed the same way. (5b49046ewas checked on conversations.im, which offers only the picture.) Fix forfeat/ui-redesignin branchfix/registration-pow(dc5b0cf): https://dev.another.im/another-im/anotherim-swift/compare/feat/ui-redesign...fix/registration-pow — the submit sends only what the person answers, as anotherim-js and master do. This PR's change (OK resubmitting a spent form) ismaster's oldRegistrationViewModelonly, which is why it stays closed.SHA-256among them: libtacky hands the … #34Pull request closed