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

flat-rose-25983

03/10/2022, 3:22 PM
Hey Folks, I want to add restriction to only allowed verified email to login and register. Currently it's working for login using this hook : How can do the same for registration flow to ?
ui_url: <http://localhost:4455/auth/login>
lifespan: 1h
after:
password:
hooks:
- hook: require_verified_address
m

magnificent-energy-493

03/10/2022, 4:05 PM
But how can the email be verified if you dont have an account yet 🤔 ?
f

flat-rose-25983

03/10/2022, 4:09 PM
I would like to run this Hook on after the user have registered .
hook: require_verified_address
I'm able to manage the redirect on the client side but the cookie is already set .
m

magnificent-energy-493

03/10/2022, 4:44 PM
Sorry I think I misunderstood, So after the sign up you don't want them to get a session, but instead verify address and then they get a session?
👍 1
f

flat-rose-25983

03/10/2022, 4:48 PM
My bad, did not explain clearly .Yes ! Exactly.
m

magnificent-energy-493

03/10/2022, 4:52 PM
Copy code
registration:
      lifespan: 10m
      ui_url: <http://127.0.0.1:4455/registration>
      after:
        password:
          hooks:
            -
              hook: session
Do you have the session hook active like this? If you remove it, the user will be required to login after the registration. And since requiring verified is working for login, that would do it? Let me know if I missed something
🙌 1
👍 1
f

flat-rose-25983

03/10/2022, 5:11 PM
Thanks a lot @User Works now .
@User Is there a way I can set session cookie once the user click on verification link. Currently it redirect to login flow again
m

magnificent-energy-493

03/15/2022, 9:25 AM
Hey @User I dont think there is an easy way to do this. Ideally the user should have an active session if they click on verification link, right? So either verify after registration (-> get active session when registering) or verify through manually starting verification flow (-> needs active session to start the flow). Am I missing something?
Hm it seems it is possible after all with hooks, have to do some more investigation 🤔
I opened an issue to make this more clear in the future, thanks for digging in @User https://github.com/ory/docs/issues/671
👍 1
f

flat-rose-25983

03/15/2022, 1:21 PM
@User when hook:
require_verified_address
is not set, the user get redirected with valid session cookie once they click on verification link. But when not set
require_verified_address
verification link redirect to loginFlow
3 Views