Skip to content

Commit 1686cd4

Browse files
committed
resolved #84: Show appropriate message on user lockout
1 parent c0813ad commit 1686cd4

File tree

4 files changed

+10
-2
lines changed

4 files changed

+10
-2
lines changed

src/AbpCompanyName.AbpProjectName.Core/Localization/Source/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" />

src/AbpCompanyName.AbpProjectName.Core/Localization/Source/AbpProjectName.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="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" />

src/AbpCompanyName.AbpProjectName.WebMpa/Controllers/AccountController.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,9 @@ private Exception CreateExceptionForFailedLoginAttempt(AbpLoginResultType result
144144
case AbpLoginResultType.UserIsNotActive:
145145
return new UserFriendlyException(L("LoginFailed"), L("UserIsNotActiveAndCanNotLogin", usernameOrEmailAddress));
146146
case AbpLoginResultType.UserEmailIsNotConfirmed:
147-
return new UserFriendlyException(L("LoginFailed"), "Your email address is not confirmed. You can not login"); //TODO: localize message
147+
return new UserFriendlyException(L("LoginFailed"), "UserEmailIsNotConfirmedAndCanNotLogin");
148+
case AbpLoginResultType.LockedOut:
149+
return new UserFriendlyException(L("LoginFailed"), L("UserLockedOutMessage"));
148150
default: //Can not fall to default actually. But other result types can be added in the future and we may forget to handle it
149151
Logger.Warn("Unhandled login fail reason: " + result);
150152
return new UserFriendlyException(L("LoginFailed"));

src/AbpCompanyName.AbpProjectName.WebSpaAngular/Controllers/AccountController.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,9 @@ private Exception CreateExceptionForFailedLoginAttempt(AbpLoginResultType result
142142
case AbpLoginResultType.UserIsNotActive:
143143
return new UserFriendlyException(L("LoginFailed"), L("UserIsNotActiveAndCanNotLogin", usernameOrEmailAddress));
144144
case AbpLoginResultType.UserEmailIsNotConfirmed:
145-
return new UserFriendlyException(L("LoginFailed"), "Your email address is not confirmed. You can not login"); //TODO: localize message
145+
return new UserFriendlyException(L("LoginFailed"), "UserEmailIsNotConfirmedAndCanNotLogin");
146+
case AbpLoginResultType.LockedOut:
147+
return new UserFriendlyException(L("LoginFailed"), L("UserLockedOutMessage"));
146148
default: //Can not fall to default actually. But other result types can be added in the future and we may forget to handle it
147149
Logger.Warn("Unhandled login fail reason: " + result);
148150
return new UserFriendlyException(L("LoginFailed"));

0 commit comments

Comments
 (0)