ory / ory/elements

Ory elements registration form sets all fields as required

Open
#574 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
TypeScript
Stars
187
Forks
80
PR merge metrics
No merged PRs in 30d

Description

Preflight checklist
Ory Network Project

No response

Describe the bug

When rendering the UI of a registration form, the optional fields are treated as required. In our case this is phone number — it is not a required field to register, however, users are not able to register without filling in the field.

The ui.nodes response :

{
    "attributes": {
        "autocomplete": "tel",
        "disabled": false,
        "name": "traits.phone",
        "node_type": "input",
        "type": "tel"
    },
    "group": "default",
    "messages": [],
    "meta": {
        "label": {
            "context": {
                "title": "Phone Number"
            },
            "id": 1070002,
            "text": "Phone Number",
            "type": "info"
        }
    },
    "type": "input"
}

And our identity schema only requires email as a required trait:

"required": [
    "email"
],

The resulting UI treats traits.phone filed as required:

Image
Reproducing the bug

We run our self-hosted Next.js app with all authentication pages.

The code for the registration page is the following:

<Registration
          flow={flow}
          config={config}
/>

The config is like this:

export const config: OryClientConfiguration = {
  intl: {
    locale: 'en', 
    customTranslations: {
      en: {
        'identities.messages.1040001': 'Continue ⮕',
      },
    },
  },
  project: {
    default_locale: 'en',
    default_redirect_url: process.env.REDIRECT_URL ?? '/',
    error_ui_url: '/error',
    locale_behavior: 'force_default',
    name: 'App',
    registration_enabled: true,
    verification_enabled: true,
    recovery_enabled: true,
    registration_ui_url: '/auth/registration',
    verification_ui_url: '/auth/verification,
    recovery_ui_url: '/auth/recovery,
    login_ui_url: '/auth/login,
    settings_ui_url: '/auth/settings,
  },
}
Relevant log output

Relevant configuration

Version

^1.1.0

On which operating system are you observing this issue?

None

In which environment are you deploying?

None

Additional Context

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the Registration component and inspect how the ui.nodes attributes are converted into required form fields, using the example where only email is required and traits.phone is optional. Verify the registration UI allows submission without a phone number while still requiring email.

Written by the indexing model from the issue text.

Assessment

Tech stack
next.js, react, typescript
Domain
authentication, frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.