Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SendConfirmationMail() #92

Open
nccheckcashing opened this issue Feb 17, 2017 · 2 comments
Open

SendConfirmationMail() #92

nccheckcashing opened this issue Feb 17, 2017 · 2 comments

Comments

@nccheckcashing
Copy link

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:

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.

Exception Details: Abp.UI.UserFriendlyException: Login failed!

Source Error:

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

Source File: C:\Users...\AbpCinotamZero-SPA-only-master\AbpCinotamZero-SPA-only-master\Cinotam.AbpModuleZero.Web\Controllers\AccountController.cs Line: 317

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.

@periface
Copy link
Member

Ok, i will check it, thanks

@periface
Copy link
Member

periface commented Feb 17, 2017

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants