We’d like to catch the password issue before the first step.
In that case, renumber step 2 as step 0. You can use try with catch to detect failures.
If a step can fail, be prepared to roll back all prior steps. A Transaction would be nice, but that wouldn’t work across multiple databases (Anvil and 3rd party), so it has to be simulated with explicit code.
Thanks for your quick response. Pity there’s no function.
We need to do the steps in the above order as we don’t want to send a confirmation email and then the API has a reason for not registering.
I thought of the try catch scenario but since we’re using email confirmation, what email address do we use? Is there a way to switch off that off temporarily so we can test the password? Or is there a ‘null’ email address we could use? If we set it to an invalid email address, that may ‘solve’ it but then you’ll likely get Anvil onto a spammers blocklist.
Following from here in the users service it goes to this server call → native-rpc / core.clj → a function named signup-with-email → a call to is-password-pwned from runtime-util / util.clj → contains the HTTP endpoint code referenced in the above post.