Unique Username using Users DB

Unique Username using Users DB

  

Hi,


Could someone help me identifying what is the best way to avoid the creation of users with the same username using the system users DB?

I tried to change the index but it seems i cannot since it's kind of greyed out.

Regards,

Joao

Hi Joao,

Who creates the users? And what do you mean by "changing the index"?

Users can't have the same username as another user, unless they have a different user provider. Is that the case?

Kilian Hekhuis wrote:

Hi Joao,

Who creates the users? And what do you mean by "changing the index"?

Users can't have the same username as another user, unless they have a different user provider. Is that the case?

Hi Kilian, 

I am using the outsystems system user DB it came in the template I had for login. 

I've implemented a registration page where I can register new users but the index in the users dB allows not unique usernames and i cannot change that. 

Hope it clarifies. 

Regards, 

Joao 


Solution

Hi João,

Try something like this in the Submit action of the form, when creating a new User

     

Solution

Hi Joao,

Of course it's not possible to have duplicate usernames, so is your question why that is, or how you can check on duplicates (if the latter, see André's post)?

If you are doing something like asking the user for their username at registration time then you should use the form validation and check if the user exists and ask the user to enter a different name. See Input Validation for some details on input validation.


Another option is to encourage users to use a username that would be unique anyway. Email address is a very good one as they have to be unique to start with. Still do the checks above though to trap situations where a user is trying to register twice plus your field validation should check for a valid email. Also good idea to allow a user to edit their username at a later date is some users do change email addresses occasionaly