fusionauth-issues icon indicating copy to clipboard operation
fusionauth-issues copied to clipboard

Allow using sendSetPasswordEmail with user.data.email

Open yoshiodeveloper opened this issue 2 years ago • 4 comments

Allow using sendSetPasswordEmail with user.data.email

Problem

I have a scenario where users have unique usernames but duplicated emails. In this case, I am unable to use the sendSetPasswordEmail option when creating a user because the user.email field is required with sendSetPasswordEmail. Since my users can have duplicated emails, I cannot use this field. Instead, I must use user.data.email for them. However, the sendSetPasswordEmail does not work with user.data.email.

Solution

Allow using user.data.email with sendSetPasswordEmail or include a new optional field when creating a user to specify the email for sending the setup password email.

yoshiodeveloper avatar Nov 30 '23 14:11 yoshiodeveloper

This should work already. If it is not, you'll need provide some additional details of the workflow you are using so we can identify if there is a bug or perhaps we can help you adjust how you are using the APIs.

Thanks.

robotdan avatar Dec 07 '23 07:12 robotdan

Basically is what I said, I set sendSetPasswordEmail=true, then I set the user.data.email but not the user.email when I create a user. This is the error:

{ "fieldErrors": { "user.email": [ { "code": "[required]user.email", "message": "You must specify the [user.email] property when [sendSetPasswordEmail] is equals to [true]." } ] }, "generalErrors": [] }

yoshiodeveloper avatar Dec 07 '23 14:12 yoshiodeveloper

Looks like the validation check (validateUserCreate) doesn't look for user.data.email only user.email, when sendSetPasswordEmail is true.

mooreds avatar Dec 07 '23 17:12 mooreds

The admin UI for creation of a new user will also need to be updated to account for this bug (I was not able to get this to work and received no error but was not allowed to create the user)

jobannon avatar May 13 '24 15:05 jobannon