You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If a new user required the email confirmation and the new user login the system using the email address as username, the user forward to the EmailNotConfirmed page. If the user click "Re-send email" button, it throw the login failed exception like below:
Login failed!
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Line 315: {
Line 316: var user = await _userManager.Users.FirstOrDefaultAsync(a => a.UserName == userName);
Line 317: if (user == null) throw CreateExceptionForFailedLoginAttempt(loginResultType, userName, tenancyName);
Line 318: var token = await _userManager.GenerateEmailConfirmationTokenAsync(user.Id);
Line 319: var confirmationUrl = Url.Action("EmailConfirmation", new
The reason is it searchs the userName to find the user object refer to the blow code. You may need to handle both userName and email address to find the user object or just allow userName only in the login page.
var user = await _userManager.Users.FirstOrDefaultAsync(a => a.UserName == userName);
if (user == null) throw CreateExceptionForFailedLoginAttempt(loginResultType, userName, tenancyName);
Thanks.
The text was updated successfully, but these errors were encountered:
I think this should fix the problem. var user = await _userManager.Users.FirstOrDefaultAsync(a => a.UserName == userName) ?? await _userManager.Users.FirstOrDefaultAsync(a => a.EmailAddress == userName);
Btw i´m still working on the refactor for the account controller, so there might be some more bugs in it.
Hello Alan,
I found one more thing.
If a new user required the email confirmation and the new user login the system using the email address as username, the user forward to the EmailNotConfirmed page. If the user click "Re-send email" button, it throw the login failed exception like below:
The reason is it searchs the userName to find the user object refer to the blow code. You may need to handle both userName and email address to find the user object or just allow userName only in the login page.
Thanks.
The text was updated successfully, but these errors were encountered: