@L["Login"]
diff --git a/modules/account/src/Volo.Abp.Account.Web/Pages/Account/Login.cshtml.cs b/modules/account/src/Volo.Abp.Account.Web/Pages/Account/Login.cshtml.cs
index 6ab8350b60..c17eb1e28f 100644
--- a/modules/account/src/Volo.Abp.Account.Web/Pages/Account/Login.cshtml.cs
+++ b/modules/account/src/Volo.Abp.Account.Web/Pages/Account/Login.cshtml.cs
@@ -10,6 +10,8 @@ using System.Diagnostics;
using System.Linq;
using System.Security.Claims;
using System.Threading.Tasks;
+using Microsoft.AspNetCore.Hosting;
+using Microsoft.Extensions.Hosting;
using Volo.Abp.Account.Settings;
using Volo.Abp.Auditing;
using Volo.Abp.Identity;
@@ -53,18 +55,22 @@ public class LoginModel : AccountPageModel
protected AbpAccountOptions AccountOptions { get; }
protected IOptions
IdentityOptions { get; }
protected IdentityDynamicClaimsPrincipalContributorCache IdentityDynamicClaimsPrincipalContributorCache { get; }
+ protected IWebHostEnvironment WebHostEnvironment { get; }
public bool ShowCancelButton { get; set; }
+ public bool ShowRequireMigrateSeedMessage { get; set; }
public LoginModel(
IAuthenticationSchemeProvider schemeProvider,
IOptions accountOptions,
IOptions identityOptions,
- IdentityDynamicClaimsPrincipalContributorCache identityDynamicClaimsPrincipalContributorCache)
+ IdentityDynamicClaimsPrincipalContributorCache identityDynamicClaimsPrincipalContributorCache,
+ IWebHostEnvironment webHostEnvironment)
{
SchemeProvider = schemeProvider;
IdentityOptions = identityOptions;
AccountOptions = accountOptions.Value;
IdentityDynamicClaimsPrincipalContributorCache = identityDynamicClaimsPrincipalContributorCache;
+ WebHostEnvironment = webHostEnvironment;
}
public virtual async Task OnGetAsync()
@@ -130,6 +136,17 @@ public class LoginModel : AccountPageModel
if (!result.Succeeded)
{
+ if (LoginInput.UserNameOrEmailAddress == IdentityDataSeedContributor.AdminUserNameDefaultValue &&
+ WebHostEnvironment.IsDevelopment())
+ {
+ var adminUser = await UserManager.FindByNameAsync(IdentityDataSeedContributor.AdminUserNameDefaultValue);
+ if (adminUser == null)
+ {
+ ShowRequireMigrateSeedMessage = true;
+ return Page();
+ }
+ }
+
Alerts.Danger(L["InvalidUserNameOrPassword"]);
return Page();
}