Base solution for your next web application
Open Closed

Update into UserAppService #7433


User avatar
0
nathaliewehbe created

Hi

I want to check the emailaddress in ABPUsers if exist do come tticks related to my project where can I modify the code, because I found the CheckErrors() in CreateOrUpdateUser() function not clear CheckErrors(await UserManager.UpdateAsync(user));


6 Answer(s)
  • User Avatar
    0
    maliming created
    Support Team

    You can do your business logic before UpdateAsync methods. CheckErrors(await UserManager.UpdateAsync(user));

    If my understanding is wrong, please explain your needs in detail.

  • User Avatar
    0
    nathaliewehbe created

    If I want to check the email address to update some field before UpdateAsync method, but then it will passing by CheckErrors function and it will return an error cz the email address already exist how can I remove this part from CheckErrors

  • User Avatar
    0
    nathaliewehbe created

    I am waiting for your reply it's high priority

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @nathaliewehbe

    If I understand you correctly, you want to allow multiple users with same email address, is that right ? If not, could you explain it a bit more detailed ?

    Thanks

  • User Avatar
    0
    nathaliewehbe created

    I want to Modify Column in the user table when the user try to add same emailaddress instead of show him a message that the email already exist

  • User Avatar
    0
    maliming created
    Support Team

    You can override the CheckDuplicateUsernameOrEmailAddressAsync method of the UserManager class to make your business logic when the user's email address is duplicated.

    https://github.com/aspnetboilerplate/aspnetboilerplate/blob/1ba43bcda0c04a901c45eab43dd091ef668048df/src/Abp.ZeroCore/Authorization/Users/AbpUserManager.cs#L409

    Please note: If no exception occurs, the update user's action will take effect.