Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Ory elements registration form sets all fields as required

未关闭
#574 1 条评论 1 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
3/5
预计耗时
1-2 天
新手友好度
38/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
停滞

调研方向

从 Registration component 开始,检查 ui.nodes 属性如何转换为必填表单字段,使用仅要求 email 而 traits.phone 可选的示例。验证 registration UI 允许在不填写电话号码的情况下提交,同时仍要求填写 email。

由索引模型根据 Issue 内容生成。

描述

bug
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

主要语言
TypeScript
星标
187
派生
80
PR 合并指标
30 天内没有已合并 PR

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

ory/elements 的其他 Issue

查看 ory/elements 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。