<@U04UQ68083H> How can I customize the label text ...
# ory-copilot
b
@chilly-king-10285 How can I customize the label text for the password field in the Ory Schema?
c
A message from kapa.ai
To customize the label text for the password field in Ory, you need to adjust the
title
property in your Identity Schema. However, according to the knowledge sources, the
title
property is used for customizing the labels of trait fields (such as email, name, etc.) that are part of the
traits
object. For example:
Copy code
json {   "properties": {     "traits": {       "type": "object",       "properties": {         "email": {           "type": "string",           "format": "email",           "title": "Email"         }       }     }   } }
This will render the label "Email" for the email field in the UI. However, for the password field specifically, the knowledge sources do not show a way to customize its label using the Identity Schema. The password field is not defined as a trait but is generated by Ory based on the enabled credential method. The label for the password field defaults to "Password" in the UI nodes, and there is no documented way to change this label via the schema itself. The only way to fully control the label would be to bring your own UI and render the form fields as you wish, as mentioned in related discussions about customizing other labels in the Ory Account Experience UI. In summary: - You can customize trait field labels using the
title
property in the Identity Schema. - There is no documented way to customize the password field label via the schema; it defaults to "Password" in the generated UI nodes. For more details, see the documentation on [custom user interface labels](https://www.ory.sh/docs/kratos/manage-identities/customize-identity-schema#custom-user-interface-labels) and [node order and labels](https://www.ory.sh/docs/kratos/concepts/ui-user-interface#node-order-and-labels).
b
@chilly-king-10285 What about customizing the value (text) for the submit button?
c
A message from kapa.ai
To customize the value (text) for the submit button in Ory, you need to understand how Ory generates UI nodes for self-service flows. The label for the submit button is provided in the
meta.label.text
property of the submit node in the flow's UI nodes. For example, a submit button node might look like this:
Copy code
json {   "type": "input",   "group": "password",   "attributes": {     "name": "method",     "type": "submit",     "value": "password",     "disabled": false   },   "messages": [],   "meta": {     "label": {       "id": 1010001,       "text": "Sign in",       "type": "info",       "context": {}     }   } }
The
"text": "Sign in"
part is what is rendered as the button label in the UI. However, the knowledge sources do not describe a way to customize this label via the identity schema or project configuration. The label is generated by Ory and is not directly configurable through the schema like trait fields are. If you need to fully control the submit button text, you would need to bring your own UI and render the button using the value from
node.meta.label.text
, or override it as you wish in your custom UI code. The Ory-provided UI and Account Experience do not currently support customizing the submit button label through configuration or schema changes [Node order and labels](https://www.ory.sh/docs/kratos/concepts/ui-user-interface#node-order-and-labels). Summary: - The submit button label is set in the UI node's
meta.label.text
. - There is no documented way to customize this label via the schema or Ory Console. - For full control, implement a custom UI and render the button with your desired text. If you need more flexibility, building a custom UI is the recommended approach.
b
@chilly-king-10285 After checking kratos source code, those labels (and many more) are hard-coded. Is there a way to get the CSRF Token when initializing a browser flow without having to go trough UI objects?
c
A message from kapa.ai
Based on the provided knowledge sources, the CSRF token is always included as a hidden input field within the
ui.nodes
array of the flow object when you initialize a browser flow (login, registration, etc.). The recommended and documented way to obtain the CSRF token is to extract it from the
ui.nodes
array by looking for the node where
attributes.name == "csrf_token"
. For example, after initializing a flow, you would parse the response and extract the CSRF token like this:
Copy code
bash csrfToken=$(echo $flow | jq -r '.ui.nodes[] | select(.attributes.name=="csrf_token") | .attributes.value')
[source](https://www.ory.sh/docs/kratos/self-service/flows/user-settings#user-and-profile-settings-for-server-side-browser-clients) There is no documented way in the knowledge sources to obtain the CSRF token directly from the top-level flow object or any other field outside of the
ui.nodes
array. The CSRF token is not exposed elsewhere in the flow response. Summary: - The CSRF token must be extracted from the
ui.nodes
array in the flow object. - There is no alternative or shortcut documented to obtain the CSRF token outside of the UI nodes. If you need the CSRF token, you must go through the UI nodes as shown in the official documentation [source](https://www.ory.sh/docs/kratos/self-service/flows/user-settings#user-and-profile-settings-for-server-side-browser-clients).