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", "BackToLogin": "Back to login",
"ProfileTab:Password": "Change password", "ProfileTab:Password": "Change password",
"ProfileTab:PersonalInfo": "Personal info", "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", "ConfirmPassword": "Potrditev (ponovitev) gesla",
"ResetPassword_Information": "Prosimo vnesite vaše novo geslo.", "ResetPassword_Information": "Prosimo vnesite vaše novo geslo.",
"YourPasswordIsSuccessfullyReset": "Vaše geslo je uspešno ponastavljeno.", "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", "BackToLogin": "Girişe dön",
"ProfileTab:Password": "Şifre değiştir", "ProfileTab:Password": "Şifre değiştir",
"ProfileTab:PersonalInfo": "Kişisel bilgiler", "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": "返回登录", "BackToLogin": "返回登录",
"ProfileTab:Password": "更改密码", "ProfileTab:Password": "更改密码",
"ProfileTab:PersonalInfo": "个人信息", "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 Microsoft.AspNetCore.Identity;
using Volo.Abp.Account.Emailing; using Volo.Abp.Account.Emailing;
using Volo.Abp.Account.Localization;
using Volo.Abp.Account.Settings; using Volo.Abp.Account.Settings;
using Volo.Abp.Application.Services; using Volo.Abp.Application.Services;
using Volo.Abp.Identity; using Volo.Abp.Identity;
@ -26,6 +26,7 @@ namespace Volo.Abp.Account
AccountEmailer = accountEmailer; AccountEmailer = accountEmailer;
IdentitySecurityLogManager = identitySecurityLogManager; IdentitySecurityLogManager = identitySecurityLogManager;
UserManager = userManager; UserManager = userManager;
LocalizationResource = typeof(AccountResource);
} }
public virtual async Task<IdentityUserDto> RegisterAsync(RegisterDto input) public virtual async Task<IdentityUserDto> RegisterAsync(RegisterDto input)
@ -66,8 +67,7 @@ namespace Volo.Abp.Account
var user = await UserManager.FindByEmailAsync(email); var user = await UserManager.FindByEmailAsync(email);
if (user == null) if (user == null)
{ {
throw new BusinessException("Volo.Account:InvalidEmailAddress") throw new UserFriendlyException(L["Volo.Account:InvalidEmailAddress", email]);
.WithData("Email", email);
} }
return user; 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() public virtual async Task<IActionResult> OnPostAsync()
{ {
await AccountAppService.SendPasswordResetCodeAsync( try
new SendPasswordResetCodeDto {
{ await AccountAppService.SendPasswordResetCodeAsync(
Email = Email, new SendPasswordResetCodeDto
AppName = "MVC", //TODO: Const! {
ReturnUrl = ReturnUrl, Email = Email,
ReturnUrlHash = ReturnUrlHash AppName = "MVC", //TODO: Const!
} ReturnUrl = ReturnUrl,
); ReturnUrlHash = ReturnUrlHash
}
);
}
catch (UserFriendlyException e)
{
Alerts.Danger(e.Message);
return Page();
}
return RedirectToPage( return RedirectToPage(
"./PasswordResetLinkSent", "./PasswordResetLinkSent",

Loading…
Cancel
Save