This forum is not used anymore. Please ask new questions to Stack Overflow: ... ort=newest (use aspnetboilerplate tag).
User avatar
By AliNM
#6456 This code returns exception and logs an error in the browser for invalid Login credentials.

private async Task<AbpUserManager<Tenant, Role, User>.AbpLoginResult> GetLoginResultAsync(string usernameOrEmailAddress, string password, string tenancyName)
var loginResult = await _userManager.LoginAsync(usernameOrEmailAddress, password, tenancyName);
switch (loginResult.Result)
case AbpLoginResultType.Success:
return loginResult;
throw CreateExceptionForFailedLoginAttempt(loginResult.Result, usernameOrEmailAddress, tenancyName);

In my case, i want to handle exception in javascript and show an error message

$('#LoginButton').click(function (e) {
url: abp.appPath + 'Account/Login',
type: 'POST',
data: JSON.stringify({
tenancyName: $('#TenancyName').val(),
usernameOrEmailAddress: $('#EmailAddressInput').val(),
password: $('#PasswordInput').val(),
rememberMe: $('#RememberMeInput').is(':checked'),
returnUrlHash: $('#ReturnUrlHash').val()

What can I do to achieve invalid credentials error message?