When we define traits or metadata public, these ar...
# ory-network
i
When we define traits or metadata public, these are also visible un the UI (Eg: registration page / Login page), is there any way to hide these attributes , but still have a ability to set these values while submitting the form ?
đź‘€ 1
i
Even after adding under metadata_admin, i see these attributes are coming in signup form. Is tehre any additional properties to be set to hide these attributes from the registration form?
m
Hello @important-area-42405 Can you share your identity schema maybe? metadata_admin/public should not be visible on the sign up page.
c
@magnificent-energy-493 cc: @important-area-42405
Copy code
{
  "$id": "<http://prodigyfinance.com/schemas/student.schema.json>",
  "title": "student",
  "type": "object",
  "properties": {
    "traits": {
      "type": "object",
      "properties": {
        "email": {
          "type": "string",
          "format": "email",
          "title": "E-Mail",
          "<http://ory.sh/kratos|ory.sh/kratos>": {
            "credentials": {
              "password": {
                "identifier": true
              },
              "webauthn": {
                "identifier": true
              },
              "totp": {
                "account_name": true
              }
            },
            "recovery": {
              "via": "email"
            },
            "verification": {
              "via": "email"
            }
          },
          "maxLength": 320
        },
        "phone": {
          "title": "Phone",
          "type": "string",
          "format": "tel",
          "<http://ory.sh/kratos|ory.sh/kratos>": {
            "credentials": {
              "password": {
                "identifier": true
              }
            }
          }
        },
        "preferred_name": {
          "title": "Preferred Name",
          "type": "string"
        }
      },
      "required": [
        "email",
        "phone",
        "preferred_name"
      ],
      "additionalProperties": false
    },
    "metadata_admin": {
      "type": "object",
      "properties": {
        "guid": {
          "title": "Guid",
          "type": "string"
        },
        "identity_type": {
          "title": "Identity Type",
          "type": "string"
        },
        "identity_issuer": {
          "title": "Identity Issuer",
          "type": "string"
        },
        "referred_by": {
          "title": "Referred By",
          "type": "string"
        }
      }
    }
  }
}
g
metadata_admin
should not be part of the schema
metadata_admin
can only be set via the admin api or through a modifying webhook (https://www.ory.sh/docs/guides/integrate-with-ory-cloud-through-webhooks#update-identity-metadata)
m
You can remove
Copy code
"type": "object",
      "properties": {
        },
from the admin_metadata and it wont be rendered as fields in the managed UI
Why should it not be part of the schema @gentle-thailand-50068? I know it doesnt “do” much in the schema, but there is no problem adding it right?
g
As far as I understand, adding it to the schema doesn’t have any effect, so there is no need to add it
👍 1
i
@magnificent-energy-493 The registration form post with this payload ignored the metadata_public { "csrf_token": "xxxx", "traits.preferred_name": "LNR", "password": "xxxxx!", "traits.email": "xx.yy@gmail.com", "traits.phone": "+91xxxxxxx", "customer_policy_accepted": true, "customer_marketing_opt_in": true, "metadata_public.identity_type": "student", "metadata_public.identity_issuer": "auth2", "method": "password" }
I was expecting self-service/registration request to honor this payload
the metadata_public attributes were hidden input fields in the form.
g
“Metadata are the attributes defined by the system admin that can’t be updated or modified by the identity owner.” https://www.ory.sh/docs/kratos/manage-identities/managing-users-identities-metadata
As I said before, you can use a webhook to set the metadata
i
okie got it
Thanks @gentle-thailand-50068
Do we have account lock for failed login attempts?
Also is there any way to notify the user for failed login attempt? The webhook, login-after-hooks , does this also gets called for unsuccessful login?
g
no it doesn’t get called see also the relevant documentation: https://www.ory.sh/docs/kratos/hooks/configure-hooks#action-triggers
i
@gentle-thailand-50068 any reason why we dont want to send webhook events for unsuccessful logins? This is important from auditing and metrics point of view
130 Views