feat: 添加超级用户默认密码
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Yi.Framework.Rbac.Domain.Shared.Options
|
||||
{
|
||||
public class RbacOptions
|
||||
{
|
||||
/// <summary>
|
||||
/// 超级管理员默认密码
|
||||
/// </summary>
|
||||
public string AdminPassword { get; set; } = "123456";
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,9 @@
|
||||
using Volo.Abp.Domain;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Volo.Abp.Domain;
|
||||
using Volo.Abp.Modularity;
|
||||
using Yi.Framework.Mapster;
|
||||
using Yi.Framework.Rbac.Domain.Shared.Options;
|
||||
|
||||
namespace Yi.Framework.Rbac.Domain.Shared
|
||||
{
|
||||
@@ -9,6 +12,12 @@ namespace Yi.Framework.Rbac.Domain.Shared
|
||||
)]
|
||||
public class YiFrameworkRbacDomainSharedModule : AbpModule
|
||||
{
|
||||
public override void ConfigureServices(ServiceConfigurationContext context)
|
||||
{
|
||||
var configuration = context.Services.GetConfiguration();
|
||||
Configure<JwtOptions>(configuration.GetSection(nameof(JwtOptions)));
|
||||
|
||||
Configure<RbacOptions>(configuration.GetSection(nameof(RbacOptions)));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,9 @@
|
||||
using Volo.Abp.Data;
|
||||
using Microsoft.Extensions.Options;
|
||||
using Volo.Abp.Data;
|
||||
using Volo.Abp.DependencyInjection;
|
||||
using Yi.Framework.Rbac.Domain.Entities;
|
||||
using Yi.Framework.Rbac.Domain.Shared.Enums;
|
||||
using Yi.Framework.Rbac.Domain.Shared.Options;
|
||||
using Yi.Framework.SqlSugarCore.Abstractions;
|
||||
|
||||
namespace Yi.Framework.Rbac.SqlSugarCore.DataSeeds
|
||||
@@ -9,9 +11,11 @@ namespace Yi.Framework.Rbac.SqlSugarCore.DataSeeds
|
||||
public class UserDataSeed : IDataSeedContributor, ITransientDependency
|
||||
{
|
||||
private ISqlSugarRepository<UserEntity> _repository;
|
||||
public UserDataSeed(ISqlSugarRepository<UserEntity> repository)
|
||||
private RbacOptions _options;
|
||||
public UserDataSeed(ISqlSugarRepository<UserEntity> repository, IOptions<RbacOptions> options)
|
||||
{
|
||||
_repository = repository;
|
||||
_options = options.Value;
|
||||
}
|
||||
public async Task SeedAsync(DataSeedContext context)
|
||||
{
|
||||
@@ -23,7 +27,7 @@ namespace Yi.Framework.Rbac.SqlSugarCore.DataSeeds
|
||||
Name = "大橙子",
|
||||
UserName = "cc",
|
||||
Nick = "橙子",
|
||||
Password = "123456",
|
||||
Password = _options.AdminPassword,
|
||||
Email = "454313500@qq.com",
|
||||
Phone = 13800000000,
|
||||
Sex = SexEnum.Male,
|
||||
|
||||
Reference in New Issue
Block a user