Browse Source

Check if current `username` is `admin`.

pull/21906/head
maliming 1 year ago
parent
commit
a8d0d20dec
No known key found for this signature in database GPG Key ID: A646B9CB645ECEA4
  1. 8
      modules/account/src/Volo.Abp.Account.Web/Pages/Account/Login.cshtml
  2. 3
      modules/account/src/Volo.Abp.Account.Web/Pages/Account/Login.cshtml.cs

8
modules/account/src/Volo.Abp.Account.Web/Pages/Account/Login.cshtml

@ -24,10 +24,10 @@
@if (Model.ShowRequireMigrateSeedMessage)
{
<div class="alert alert-danger">
<h4 class="alert-heading">@L["RequireMigrateSeedTitle"]</h4>
<p>@L["RequireMigrateSeedMessage"]</p>
</div>
<div class="alert alert-danger">
<h4 class="alert-heading">@L["RequireMigrateSeedTitle"]</h4>
<p>@L["RequireMigrateSeedMessage"]</p>
</div>
}
<div class="card mt-3 shadow-sm rounded">

3
modules/account/src/Volo.Abp.Account.Web/Pages/Account/Login.cshtml.cs

@ -136,7 +136,8 @@ public class LoginModel : AccountPageModel
if (!result.Succeeded)
{
if (WebHostEnvironment.IsDevelopment())
if (LoginInput.UserNameOrEmailAddress == IdentityDataSeedContributor.AdminUserNameDefaultValue &&
WebHostEnvironment.IsDevelopment())
{
var adminUser = await UserManager.FindByNameAsync(IdentityDataSeedContributor.AdminUserNameDefaultValue);
if (adminUser == null)

Loading…
Cancel
Save