https://www.ory.sh/ logo
p

proud-controller-61667

03/25/2022, 12:43 PM
Hey everone, I'm trying to add some sort of asynchronous validation on the self-service registration (basically, querying an API to check if the email can actually register). It seems that the "after registration hook" happens after persist. Is there a way to configure it as a prepersist hook?
j

jolly-jelly-9637

03/25/2022, 1:48 PM
https://ory-community.slack.com/archives/C012RJ2MQ1H/p1648130108307289?thread_ts=1648127686.243159&cid=C012RJ2MQ1H Unfortunately, no way to do this. I’m looking for a similar workaround as well.
p

proud-controller-61667

03/25/2022, 1:55 PM
Indeed, I didn't see this PR (nor the message from yesterday... 😪 ). Let's ping @User and see whether we can help him?
👍 1
j

jolly-jelly-9637

03/25/2022, 2:43 PM
I’ll have a lot of free time from 1st-10th of April to help 🙂
l

lemon-mouse-24294

03/28/2022, 11:50 AM
Thanks. We are finishing internal review and we are going to proceed with the internal tests. There are a lot of changes on the master branch since this PR was created so we need to double check that all functionalities work as intended. What would be nice if someone could re-test after our round of tests since we have a limited resources right now and we might have some biases so fresh test run could uncover some cases we have missed.
p

proud-controller-61667

03/29/2022, 10:46 AM
j

jolly-jelly-9637

04/01/2022, 12:03 PM
@User I’m free now to help as well. I looked into your PR and it looks good to me. Obviously someone from ORY would have to approve the changes 🙂 Going a step further, we should figure out how to propagate error messages. With this PR I think it would be reported as a system error which would lead to a bad user experience. @User would you guys like to give a suggestion on how would you handle error propagation for webhooks? I’ll have some time to contribute and implement it 🙂
l

lemon-mouse-24294

04/01/2022, 12:06 PM
We are now starting internal tests so I will let you know how it went. I’m open to suggestions since this is based on my initial idea just to allow to display some validation errors to the user and it seems to work well but it is probably not 100% bullet proof in all cases.
👍 1
p

proud-controller-61667

04/01/2022, 1:27 PM
@User I think there's a problem with your implementation, where hooks will be executed twice (one for pre persist, one for post persist). My PR above fixes that, but it will probably change some things from your side
l

lemon-mouse-24294

04/01/2022, 1:29 PM
Well it is not exactly problem with my PR I believe this is the issue with how hooks are registered/executed for
pre-
and
post-
persists events.
We have also separate fix for that.
I see. So https://github.com/ory/kratos/pull/2343 is one way to do it. Another one which does not break backward compatibility (if there is one in this case) would be something like this https://github.com/Wikia/kratos/pull/38. I think both are fine
p

proud-controller-61667

04/01/2022, 1:36 PM
Both work indeed
l

lemon-mouse-24294

04/01/2022, 1:47 PM
Anyway thanks for reminding me about this one. We have this fix on prod but I’ve totally forgot about it and we should have pushed this change to upstream. I hope this will be merged soon!
🙌 1
p

proud-controller-61667

04/01/2022, 1:48 PM
Love wikia/fandom btw 😄
l

lemon-mouse-24294

04/01/2022, 1:51 PM
Thanks 🙂 We hope to contribute more to Ory ecosystem but lately we are quite busy 😞
4 Views