billions-fireman-81445
12/12/2024, 9:30 PMbrief-egg-61061
12/12/2024, 9:30 PMbrief-egg-61061
12/12/2024, 9:31 PMjson
{
"properties": {
"traits": {
"type": "object",
"properties": {
"email": {
"type": "string",
"format": "email",
"title": "E-Mail",
"<http://ory.sh/kratos|ory.sh/kratos>": {
"credentials": {
"password": {
"identifier": true
}
},
"verification": {
"via": "email"
},
"recovery": {
"via": "email"
}
}
},
"tos": {
"type": "boolean",
"title": "Accept Terms of Service",
"default": false
}
},
"required": [
"email",
"tos"
]
}
}
}
This example is based on the identity schema shown in the [Ory documentation](https://www.ory.sh/docs/kratos/self-service/flows/user-registration#registration-with-usernameemail-and-password).
2. After updating your identity schema, the registration flow will automatically include a checkbox for the terms of service agreement. The checkbox will appear in the UI as shown in this example from the documentation:
json
{
"type": "input",
"group": "password",
"attributes": {
"name": "traits.tos",
"type": "checkbox",
"required": true,
"disabled": false,
"node_type": "input"
},
"messages": [],
"meta": {
"label": {
"id": 1070002,
"text": "Accept Tos",
"type": "info"
}
}
}
[Source](https://www.ory.sh/docs/kratos/bring-your-own-ui/custom-ui-basic-integration#create-registration-flow)
3. To add a custom message with a link to your terms of service, you'll need to customize the registration template. You can do this by following the instructions in the [Email templates documentation](https://www.ory.sh/docs/kratos/emails-sms/custom-email-templates#using-custom-message-templates).
4. In your custom template, you can add the message with the link to your terms of service. For example:
html
<form action="{{action}}" method="POST">
{{#each nodes}}
<!-- Render other form fields -->
{{/each}}
<p>By signing up, you agree to our <a href="https://your-website.com/terms-of-service">terms of service</a>.</p>
<button type="submit">Sign up</button>
</form>
Remember to replace <https://your-website.com/terms-of-service>
with the actual URL of your terms of service page.brief-egg-61061
12/12/2024, 9:31 PM