I've created a custom schema where both email and ...
# ory-network
w
I've created a custom schema where both email and username is required. When I try to create an account through Twitter, it fills in my e-mail address but (obviously) leaves the username blank. However, it shows that "property username is missing" until I type it in myself. Is this intended?
s
you have to adjust the jsonnet mapping code for twitter in the social sign-in settings (hidden in advanced settings)
there you can specify how the username is filled from the data coming from twitter
w
Ah no, I would like the user to pick their own username for their identity in our ecosystem; I was talking about the error message being pre-filled!
s
I see, the reason is that the full validation happens after the data is filled from twitter, where the username is obviously missing however the "complete registration" step is only shown when there is some validation error...
really the only way to change this would be to create a custom UI that shows better messages
w
And then I added a regex check for the username and it looks like the full pattern shows up as an error 😞
s
We're working on a new version of the Ory UI that will also allow you to customize messages, but that will take a few more weeks. Currently, you would have to build your own UI.
❤️ 1
w
Awesome, can't wait!
l
@wooden-nightfall-55264 I am curious how you added the regex for the username. Would you be able to share how you did this?
w
Copy code
"username": {
          "type": "string",
          "title": "Username",
          "maxLength": 32,
          "pattern": "^\\w+$",
          "<http://ory.sh/kratos|ory.sh/kratos>": {
            "credentials": {
              "password": {
                "identifier": true
              }
            }
          }
        },
👍 1