<@U04UQ68083H> can you tell me or give me a link t...
# ory-copilot
i
@chilly-king-10285 can you tell me or give me a link to the docs how to handle email resent for unverified users?
c
A message from kapa.ai
Sure, I can guide you on how to handle email resend for unverified users in Ory. To re-request the verification email, you need to fill out the form at
127.0.0.1:4455/verification
. More details about verification recovery can be found in the [Email and Phone Verification and Account Activation Documentation](https://www.ory.sh/docs/kratos/self-service/flows/verify-email-account-activation). In the case of custom UI integration, you can use the "Resend code" option. Here is a snippet of the JSON structure:
Copy code
json {   "type": "input",   "group": "default",   "attributes": {     "name": "csrf_token",     "type": "hidden",     "value": "",     "required": true,     "disabled": false,     "node_type": "input"   },   "messages": [],   "meta": {     "label": {       "id": 1070007,       "text": "Resend code",       "type": "info"     }   } }
The system will then send an email containing a verification code to the email address provided. The state of this action will be "sent_email". Please note that it's important to ensure that the email address is verified before using it in your identity. Allowing unverified email addresses can enable account enumeration attacks, especially if the value is used for verification or as a password login identifier. For more detailed information, you can refer to the following documentation: - [Submit Verification Flow](https://www.ory.sh/docs/kratos/bring-your-own-ui/custom-ui-basic-integration#submit-verification-flow) - [Email Verification](https://www.ory.sh/docs/kratos/quickstart#email-verification) - [Data Mapping](https://www.ory.sh/docs/kratos/social-signin/data-mapping#emails-and-phone-numbers)
i
@chilly-king-10285 do I understand it correctly that I need to trigger the recovery flow in order to resend the verification mail?
c
A message from kapa.ai
No, you don't need to trigger the recovery flow to resend the verification email. These are two separate flows in Ory. The recovery flow is used when a user has forgotten their password and needs to recover their account. The verification flow, on the other hand, is used to verify the user's email address. To resend the verification email, you need to initiate the verification flow again. This can be done by filling out the form at
127.0.0.1:4455/verification
. For more details, you can refer to the [Email Verification](https://www.ory.sh/docs/kratos/quickstart#email-verification) section in the Ory documentation.
i
@chilly-king-10285 but to which endpoint do I have to send the "Resend code" option using a custom-ui?
c
A message from kapa.ai
To resend the verification code using a custom UI, you need to send a POST request to the
/self-service/verification
endpoint. Here is an example of how you can do this using cURL:
Copy code
bash curl -X POST \     -H 'Content-Type: application/json' \     -H 'Accept: application/json' \     -b cookies.txt \     -d '{"method":"code","email":"[email protected]","csrf_token":"your-csrf-token"}' \     "https://$<http://PROJECT_SLUG.projects.oryapis.com/self-service/verification?flow=<your-flow-id|PROJECT_SLUG.projects.oryapis.com/self-service/verification?flow=<your-flow-id>>"
In this request, replace
[email protected]
with the user's email,
your-csrf-token
with the CSRF token, and
<your-flow-id>
with the ID of your flow. For more details, you can refer to the [Submit Verification Flow](https://www.ory.sh/docs/kratos/bring-your-own-ui/custom-ui-basic-integration#submit-verification-flow) section in the Ory documentation.
i
@chilly-king-10285 ok, so
updateVerificationFlow
does both if I provide
code
as payload it will verify the registration code, if I provide
email
it will resent a new code. Is that correct?
c
A message from kapa.ai
No, that's not correct. The
updateRegistrationFlow
endpoint is used to update the registration flow, not to verify the registration code or resend a new code. To verify the registration code, you would typically use the
updateVerificationFlow
endpoint. This endpoint accepts a payload with the
method
field set to
code
and the
code
field set to the verification code you want to verify. To resend a new code, you would initiate the verification flow again by sending a POST request to the
/self-service/verification
endpoint with the
email
field set to the user's email. For more details, you can refer to the [Submit Verification Flow](https://www.ory.sh/docs/kratos/bring-your-own-ui/custom-ui-basic-integration#submit-verification-flow) section in the Ory documentation.
A message from kapa.ai
New message text here