Browse Source

Show the error message when typing the wrong email

pull/5768/head
liangshiwei 6 years ago
parent
commit
d20d345852
  1. 3
      modules/account/src/Volo.Abp.Account.Application.Contracts/Volo/Abp/Account/Localization/Resources/en.json
  2. 3
      modules/account/src/Volo.Abp.Account.Application.Contracts/Volo/Abp/Account/Localization/Resources/sl.json
  3. 3
      modules/account/src/Volo.Abp.Account.Application.Contracts/Volo/Abp/Account/Localization/Resources/tr.json
  4. 5
      modules/account/src/Volo.Abp.Account.Application.Contracts/Volo/Abp/Account/Localization/Resources/zh-Hans.json
  5. 8
      modules/account/src/Volo.Abp.Account.Application/Volo/Abp/Account/AccountAppService.cs
  6. 27
      modules/account/src/Volo.Abp.Account.Web/Pages/Account/ForgotPassword.cshtml.cs

3
modules/account/src/Volo.Abp.Account.Application.Contracts/Volo/Abp/Account/Localization/Resources/en.json

@ -56,6 +56,7 @@
"BackToLogin": "Back to login",
"ProfileTab:Password": "Change password",
"ProfileTab:PersonalInfo": "Personal info",
"ReturnToApplication": "Return to application"
"ReturnToApplication": "Return to application",
"Volo.Account:InvalidEmailAddress": "Can not find the given email address: {0}"
}
}

3
modules/account/src/Volo.Abp.Account.Application.Contracts/Volo/Abp/Account/Localization/Resources/sl.json

@ -48,6 +48,7 @@
"ConfirmPassword": "Potrditev (ponovitev) gesla",
"ResetPassword_Information": "Prosimo vnesite vaše novo geslo.",
"YourPasswordIsSuccessfullyReset": "Vaše geslo je uspešno ponastavljeno.",
"BackToLogin": "Nazaj na prijavo"
"BackToLogin": "Nazaj na prijavo",
"Volo.Account:InvalidEmailAddress": "Navedenega e-poštnega naslova ni mogoče najti: {0}"
}
}

3
modules/account/src/Volo.Abp.Account.Application.Contracts/Volo/Abp/Account/Localization/Resources/tr.json

@ -56,6 +56,7 @@
"BackToLogin": "Girişe dön",
"ProfileTab:Password": "Şifre değiştir",
"ProfileTab:PersonalInfo": "Kişisel bilgiler",
"ReturnToApplication": "Uygulamaya geri dön"
"ReturnToApplication": "Uygulamaya geri dön",
"Volo.Account:InvalidEmailAddress": "Email adresi bulunamadı: {0}"
}
}

5
modules/account/src/Volo.Abp.Account.Application.Contracts/Volo/Abp/Account/Localization/Resources/zh-Hans.json

@ -55,6 +55,9 @@
"BackToLogin": "返回登录",
"ProfileTab:Password": "更改密码",
"ProfileTab:PersonalInfo": "个人信息",
"ReturnToApplication": "返回到应用程序"
"ReturnToApplication": "返回到应用程序",
"Volo.Account:InvalidEmailAddress": "找不到给定的电子邮件地址:{0}",
"Volo.Account:SelfRegistrationDisabled": "自我注册已禁用!",
}
}

8
modules/account/src/Volo.Abp.Account.Application/Volo/Abp/Account/AccountAppService.cs

@ -1,7 +1,7 @@
using System.Linq;
using System.Threading.Tasks;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Identity;
using Volo.Abp.Account.Emailing;
using Volo.Abp.Account.Localization;
using Volo.Abp.Account.Settings;
using Volo.Abp.Application.Services;
using Volo.Abp.Identity;
@ -26,6 +26,7 @@ namespace Volo.Abp.Account
AccountEmailer = accountEmailer;
IdentitySecurityLogManager = identitySecurityLogManager;
UserManager = userManager;
LocalizationResource = typeof(AccountResource);
}
public virtual async Task<IdentityUserDto> RegisterAsync(RegisterDto input)
@ -66,8 +67,7 @@ namespace Volo.Abp.Account
var user = await UserManager.FindByEmailAsync(email);
if (user == null)
{
throw new BusinessException("Volo.Account:InvalidEmailAddress")
.WithData("Email", email);
throw new UserFriendlyException(L["Volo.Account:InvalidEmailAddress", email]);
}
return user;

27
modules/account/src/Volo.Abp.Account.Web/Pages/Account/ForgotPassword.cshtml.cs

@ -29,15 +29,24 @@ namespace Volo.Abp.Account.Web.Pages.Account
public virtual async Task<IActionResult> OnPostAsync()
{
await AccountAppService.SendPasswordResetCodeAsync(
new SendPasswordResetCodeDto
{
Email = Email,
AppName = "MVC", //TODO: Const!
ReturnUrl = ReturnUrl,
ReturnUrlHash = ReturnUrlHash
}
);
try
{
await AccountAppService.SendPasswordResetCodeAsync(
new SendPasswordResetCodeDto
{
Email = Email,
AppName = "MVC", //TODO: Const!
ReturnUrl = ReturnUrl,
ReturnUrlHash = ReturnUrlHash
}
);
}
catch (UserFriendlyException e)
{
Alerts.Danger(e.Message);
return Page();
}
return RedirectToPage(
"./PasswordResetLinkSent",

Loading…
Cancel
Save