Skip to content

Commit a70fa8b

Browse files
committed
resolved #13, resolved #19: added lockout message and set localization source on AbpLoginResultTypeHelper constructor.
1 parent 590943f commit a70fa8b

File tree

4 files changed

+13
-3
lines changed

4 files changed

+13
-3
lines changed

aspnet-core/src/AbpCompanyName.AbpProjectName.Application/AbpProjectNameAppServiceBase.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
using System.Threading.Tasks;
33
using Abp.Application.Services;
44
using AbpCompanyName.AbpProjectName.MultiTenancy;
5-
using AbpCompanyName.AbpProjectName.Users;
65
using Microsoft.AspNet.Identity;
76
using Abp.Runtime.Session;
87
using Abp.IdentityFramework;

aspnet-core/src/AbpCompanyName.AbpProjectName.Application/Authorization/AbpLoginResultTypeHelper.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@ namespace AbpCompanyName.AbpProjectName.Authorization
88
{
99
public class AbpLoginResultTypeHelper : AbpServiceBase, ITransientDependency
1010
{
11+
public AbpLoginResultTypeHelper()
12+
{
13+
LocalizationSourceName = AbpProjectNameConsts.LocalizationSourceName;
14+
}
15+
1116
public Exception CreateExceptionForFailedLoginAttempt(AbpLoginResultType result, string usernameOrEmailAddress, string tenancyName)
1217
{
1318
switch (result)
@@ -25,6 +30,8 @@ public Exception CreateExceptionForFailedLoginAttempt(AbpLoginResultType result,
2530
return new UserFriendlyException(L("LoginFailed"), L("UserIsNotActiveAndCanNotLogin", usernameOrEmailAddress));
2631
case AbpLoginResultType.UserEmailIsNotConfirmed:
2732
return new UserFriendlyException(L("LoginFailed"), L("UserEmailIsNotConfirmedAndCanNotLogin"));
33+
case AbpLoginResultType.LockedOut:
34+
return new UserFriendlyException(L("LoginFailed"), L("UserLockedOutMessage"));
2835
default: //Can not fall to default actually. But other result types can be added in the future and we may forget to handle it
2936
Logger.Warn("Unhandled login fail reason: " + result);
3037
return new UserFriendlyException(L("LoginFailed"));

aspnet-core/src/AbpCompanyName.AbpProjectName.Core/Localization/SourceFiles/AbpProjectName-tr.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
<text name="ThereIsNoTenantDefinedWithName{0}" value="{0} isminde bir müşteri tanımlı değildir." />
1313
<text name="TenantIsNotActive" value="{0} isimli müşteri aktif edilmemiştir." />
1414
<text name="UserIsNotActiveAndCanNotLogin" value="{0} isimli kullanıcı pasife alınmıştır ve sisteme giremez." />
15+
<text name="UserEmailIsNotConfirmedAndCanNotLogin">E-posta adresiniz doğrulanmadı, giriş yapamazsınız.</text>
16+
<text name="UserLockedOutMessage">Kullanıcı hesabı kilitlenmiş. Lütfen bir süre sonra tekrar deneyin.</text>
1517
<text name="PleaseEnterLoginInformation" value="Lütfen giriş bilgilerinizi girin" />
1618
<text name="TenancyName" value="Müşteri adı" />
1719
<text name="UserNameOrEmail" value="Kullanıcı adı ya da e-posta" />

aspnet-core/src/AbpCompanyName.AbpProjectName.Core/Localization/SourceFiles/AbpProjectName.xml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,16 @@
44
<text name="HomePage" value="Home page" />
55
<text name="About" value="About" />
66
<text name="WellcomeMessage" value="Welcome to AbpProjectName!" />
7-
7+
88
<text name="FormIsNotValidMessage" value="Form is not valid. Please check and fix errors." />
99
<text name="TenantNameCanNotBeEmpty" value="Tenant name can not be empty" />
1010

1111
<text name="InvalidUserNameOrPassword" value="Invalid user name or password" />
1212
<text name="ThereIsNoTenantDefinedWithName{0}" value="There is no tenant defined with name {0}" />
1313
<text name="TenantIsNotActive" value="Tenant {0} is not active." />
1414
<text name="UserIsNotActiveAndCanNotLogin" value="User {0} is not active and can not log in." />
15+
<text name="UserEmailIsNotConfirmedAndCanNotLogin">Your email address is not confirmed. You can not login</text>
16+
<text name="UserLockedOutMessage">The user account has been locked out. Please try again later.</text>
1517
<text name="PleaseEnterLoginInformation" value="Please enter login information" />
1618
<text name="TenancyName" value="Tenancy name" />
1719
<text name="UserNameOrEmail" value="User name or email" />
@@ -54,7 +56,7 @@
5456
<text name="No" value="No" />
5557
<text name="Optional" value="Optional" />
5658
<text name="LeaveEmptyToSwitchToHost">Leave empty to switch to the host</text>
57-
59+
5860
<text name="CurrentTenant">Current tenant</text>
5961
<text name="NotSelected">Not selected</text>
6062
<text name="Change">Change</text>

0 commit comments

Comments
 (0)