We should create a new UniqueFieldUserEvent event that will be dispatched when the validation for users has failed. We should pass the field name and submitted value to the event as arguments.
i.e., after adding a new error $form_state->setErrorByName()

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

astonvictor created an issue. See original summary.

shubham_pareek_19 made their first commit to this issue’s fork.

shubham_pareek_19’s picture

Status: Active » Needs review
boddy’s picture

Assigned: Unassigned » boddy
boddy’s picture

Assigned: boddy » Unassigned
Status: Needs review » Reviewed & tested by the community

Fixed merge conflicts.

Created an additional field 'field_text', set Unique Field restrictions for it in User.
Edited the existing user's field, tried to add the second one with the same value.
The UniqueFieldUserEvent event was dispatched successfully.

RTBC

astonvictor’s picture

Status: Reviewed & tested by the community » Needs work

merge conflicts

astonvictor’s picture

Status: Needs work » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.