create user with email as username

Hello, I am using the rest of openmrs api to register users but one of the requirements is that the username is the email.

I tried to save the email in the user name field and I got the following error “{” error “: {” message “:” [‘’ failed to validate with reason: username: Username is invalid. It must be between 2 and 50 characters. Only letters, digits, \ ". ", \ "- ", and \ "_ " are allowed.] "

Is there a way that the email can be saved as if it were the username?

Set the value of the global property or setting named user.requireEmailAsUsername to true

Thank you :smiley: :smiley:

Hi @dkayiwa ,

We have the same requirement and we are using openmrs sdk. where do we need to add user.requireEmailAsUsername=true so that we can take email as username.

Take a look at Maintenance · GitBook under OpenMRS Settings

1 Like

thank you @dkayiwa it worked.