Browse Source
Merge pull request #7723 from abpframework/maliming/Identity-dataSeeder
Explicitly set email & password in the initial data seed of startup templates.
pull/7778/head
liangshiwei
6 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with
12 additions and
3 deletions
-
modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityDataSeedContributor.cs
-
templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Domain/Data/MyProjectNameDbMigrationService.cs
|
|
|
@ -6,6 +6,11 @@ namespace Volo.Abp.Identity |
|
|
|
{ |
|
|
|
public class IdentityDataSeedContributor : IDataSeedContributor, ITransientDependency |
|
|
|
{ |
|
|
|
public const string AdminEmailPropertyName = "AdminEmail"; |
|
|
|
public const string AdminEmailDefaultValue = "admin@abp.io"; |
|
|
|
public const string AdminPasswordPropertyName = "AdminPassword"; |
|
|
|
public const string AdminPasswordDefaultValue = "1q2w3E*"; |
|
|
|
|
|
|
|
protected IIdentityDataSeeder IdentityDataSeeder { get; } |
|
|
|
|
|
|
|
public IdentityDataSeedContributor(IIdentityDataSeeder identityDataSeeder) |
|
|
|
@ -16,8 +21,8 @@ namespace Volo.Abp.Identity |
|
|
|
public virtual Task SeedAsync(DataSeedContext context) |
|
|
|
{ |
|
|
|
return IdentityDataSeeder.SeedAsync( |
|
|
|
context?["AdminEmail"] as string ?? "admin@abp.io", |
|
|
|
context?["AdminPassword"] as string ?? "1q2w3E*", |
|
|
|
context?[AdminEmailPropertyName] as string ?? AdminEmailDefaultValue, |
|
|
|
context?[AdminPasswordPropertyName] as string ?? AdminPasswordDefaultValue, |
|
|
|
context?.TenantId |
|
|
|
); |
|
|
|
} |
|
|
|
|
|
|
|
@ -9,6 +9,7 @@ using Microsoft.Extensions.Logging; |
|
|
|
using Microsoft.Extensions.Logging.Abstractions; |
|
|
|
using Volo.Abp.Data; |
|
|
|
using Volo.Abp.DependencyInjection; |
|
|
|
using Volo.Abp.Identity; |
|
|
|
using Volo.Abp.MultiTenancy; |
|
|
|
using Volo.Abp.TenantManagement; |
|
|
|
|
|
|
|
@ -105,7 +106,10 @@ namespace MyCompanyName.MyProjectName.Data |
|
|
|
{ |
|
|
|
Logger.LogInformation($"Executing {(tenant == null ? "host" : tenant.Name + " tenant")} database seed..."); |
|
|
|
|
|
|
|
await _dataSeeder.SeedAsync(tenant?.Id); |
|
|
|
await _dataSeeder.SeedAsync(new DataSeedContext(tenant?.Id) |
|
|
|
.WithProperty(IdentityDataSeedContributor.AdminEmailPropertyName, IdentityDataSeedContributor.AdminEmailDefaultValue) |
|
|
|
.WithProperty(IdentityDataSeedContributor.AdminPasswordPropertyName, IdentityDataSeedContributor.AdminPasswordDefaultValue) |
|
|
|
); |
|
|
|
} |
|
|
|
|
|
|
|
private bool DbMigrationsProjectExists() |
|
|
|
|