Browse Source
Merge pull request #5768 from abpframework/liangshiwei/patch-account
Show the error message when typing the wrong email
pull/5791/head
maliming
6 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with
32 additions and
17 deletions
-
modules/account/src/Volo.Abp.Account.Application.Contracts/Volo/Abp/Account/Localization/Resources/en.json
-
modules/account/src/Volo.Abp.Account.Application.Contracts/Volo/Abp/Account/Localization/Resources/sl.json
-
modules/account/src/Volo.Abp.Account.Application.Contracts/Volo/Abp/Account/Localization/Resources/tr.json
-
modules/account/src/Volo.Abp.Account.Application.Contracts/Volo/Abp/Account/Localization/Resources/zh-Hans.json
-
modules/account/src/Volo.Abp.Account.Application/Volo/Abp/Account/AccountAppService.cs
-
modules/account/src/Volo.Abp.Account.Web/Pages/Account/ForgotPassword.cshtml.cs
|
|
|
@ -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}" |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@ -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}" |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@ -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}" |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@ -55,6 +55,9 @@ |
|
|
|
"BackToLogin": "返回登录", |
|
|
|
"ProfileTab:Password": "更改密码", |
|
|
|
"ProfileTab:PersonalInfo": "个人信息", |
|
|
|
"ReturnToApplication": "返回到应用程序" |
|
|
|
"ReturnToApplication": "返回到应用程序", |
|
|
|
"Volo.Account:InvalidEmailAddress": "找不到给定的电子邮件地址:{0}", |
|
|
|
"Volo.Account:SelfRegistrationDisabled": "自我注册已禁用!", |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@ -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; |
|
|
|
|
|
|
|
@ -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", |
|
|
|
|