Base solution for your next web application
Open Closed

"Invalid Email Address" thrown for existing users. #10228


User avatar
0
timmackey created

ANZ ver 8.1.0 angular/.net core

When I use the "Forgot Password" interface, this code in AccountAppService.cs keeps throwing an "InvalidEmailAddress" exception for email addresses of existing users.

        private async Task<User> GetUserByChecking(string inputEmailAddress)
        {
            var user = await UserManager.FindByEmailAsync(inputEmailAddress);
            if (user == null)
            {
                throw new UserFriendlyException(L("InvalidEmailAddress"));
            }

            return user;
        }

1 Answer(s)
  • User Avatar
    0
    timmackey created

    This issue has been resolved by using the injected UserManager. i.e.

    var user = await _userManager.FindByEmailAsync(inputEmailAddress);