Skip to content

Commit

Permalink
fix(ui): properly passes readOnly prop to email & username auth fie…
Browse files Browse the repository at this point in the history
…lds (#9938)

### What?

The `readOnly` prop was not being passed down to the `email` &
`username` auth fields.

Resulting in these fields not being disabled properly if `update` access
was restricted.

### How?

Passes the `readOnly` prop through to the fields and now properly
disables these fields if `update` access is restricted.
  • Loading branch information
PatrikKozak authored Dec 12, 2024
1 parent 7a8b464 commit a582431
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/ui/src/elements/EmailAndUsername/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ type RenderEmailAndUsernameFieldsProps = {
}

export function EmailAndUsernameFields(props: RenderEmailAndUsernameFieldsProps) {
const { className, loginWithUsername, t } = props
const { className, loginWithUsername, readOnly, t } = props

const showEmailField =
!loginWithUsername || loginWithUsername?.requireEmail || loginWithUsername?.allowEmailLogin
Expand All @@ -43,6 +43,7 @@ export function EmailAndUsernameFields(props: RenderEmailAndUsernameFieldsProps)
required: !loginWithUsername || (loginWithUsername && loginWithUsername.requireEmail),
}}
path="email"
readOnly={readOnly}
schemaPath="email"
validate={email}
/>
Expand All @@ -55,6 +56,7 @@ export function EmailAndUsernameFields(props: RenderEmailAndUsernameFieldsProps)
required: loginWithUsername && loginWithUsername.requireUsername,
}}
path="username"
readOnly={readOnly}
schemaPath="username"
validate={username}
/>
Expand Down

0 comments on commit a582431

Please sign in to comment.