Developer forum

Forum » Development » Require unique user names (and a unique custom attribute)

Require unique user names (and a unique custom attribute)

Albert Gyllenhoof
Reply

Hi,

When visitors register for an account on our website, we would like to check whether the user name and one of our custom fields are already taken by someone else. On our platform, different users are allowed to have the same e-mail, as the same person may hold several accounts, but the user name must be unique, and the number for their organization must also be unique.

We are using the Extranet app for creating new profiles, which comes with an option to require unique email addresses, but no such option for other fields:

Yet in the error messages part of the app, there's a default error message for user names that are already taken:

So we were thinking that this kind of default behavior must already exist.

Is there any way for us to easily check whether a user with that user name and custom field (in our case: organization number) already exist?

Thank you!


Replies

 
Nicolai Pedersen
Reply
This post has been marked as an answer

Hi Albert

You cannot check on custom fields - only the username as per the settings above.

You would have to do some kind of check yourself - you can maybe do a Security.UserManagement.Notifications.Notifications.UserValidated notification subscriber that adds an error to the error list in the args of that, and make the user creation fail if conditions are not met.

BR Nicolai

Votes for this answer: 1

 

You must be logged in to post in the forum