diff --git a/modules/account/src/Volo.Abp.Account.Application.Contracts/Volo/Abp/Account/AbpAccountApplicationContractsModule.cs b/modules/account/src/Volo.Abp.Account.Application.Contracts/Volo/Abp/Account/AbpAccountApplicationContractsModule.cs index 1400fd5f258..ff5792c70b5 100644 --- a/modules/account/src/Volo.Abp.Account.Application.Contracts/Volo/Abp/Account/AbpAccountApplicationContractsModule.cs +++ b/modules/account/src/Volo.Abp.Account.Application.Contracts/Volo/Abp/Account/AbpAccountApplicationContractsModule.cs @@ -39,8 +39,7 @@ public override void ConfigureServices(ServiceConfigurationContext context) }); } - public override void PostConfigureServices(ServiceConfigurationContext context) - { + public override void PostConfigureServices(ServiceConfigurationContext context)=> OneTimeRunner.Run(() => { ModuleExtensionConfigurationHelper.ApplyEntityConfigurationToApi( @@ -50,5 +49,5 @@ public override void PostConfigureServices(ServiceConfigurationContext context) updateApiTypes: new[] { typeof(UpdateProfileDto) } ); }); - } + } diff --git a/modules/account/src/Volo.Abp.Account.Application/Volo/Abp/Account/AbpAccountApplicationModuleAutoMapperProfile.cs b/modules/account/src/Volo.Abp.Account.Application/Volo/Abp/Account/AbpAccountApplicationModuleAutoMapperProfile.cs index 0c117d98d0d..0f8e5b2f920 100644 --- a/modules/account/src/Volo.Abp.Account.Application/Volo/Abp/Account/AbpAccountApplicationModuleAutoMapperProfile.cs +++ b/modules/account/src/Volo.Abp.Account.Application/Volo/Abp/Account/AbpAccountApplicationModuleAutoMapperProfile.cs @@ -5,11 +5,9 @@ namespace Volo.Abp.Account; public class AbpAccountApplicationModuleAutoMapperProfile : Profile { - public AbpAccountApplicationModuleAutoMapperProfile() - { + public AbpAccountApplicationModuleAutoMapperProfile() => CreateMap() .ForMember(dest => dest.HasPassword, op => op.MapFrom(src => src.PasswordHash != null)) .MapExtraProperties(); - } } diff --git a/modules/account/src/Volo.Abp.Account.Application/Volo/Abp/Account/DynamicClaimsAppService.cs b/modules/account/src/Volo.Abp.Account.Application/Volo/Abp/Account/DynamicClaimsAppService.cs index e26dbfc979f..f8bbcd728a7 100644 --- a/modules/account/src/Volo.Abp.Account.Application/Volo/Abp/Account/DynamicClaimsAppService.cs +++ b/modules/account/src/Volo.Abp.Account.Application/Volo/Abp/Account/DynamicClaimsAppService.cs @@ -7,21 +7,14 @@ namespace Volo.Abp.Account; [Authorize] -public class DynamicClaimsAppService : IdentityAppServiceBase, IDynamicClaimsAppService +public class DynamicClaimsAppService( + IdentityDynamicClaimsPrincipalContributorCache identityDynamicClaimsPrincipalContributorCache, + IAbpClaimsPrincipalFactory abpClaimsPrincipalFactory, + ICurrentPrincipalAccessor principalAccessor) : IdentityAppServiceBase, IDynamicClaimsAppService { - protected IdentityDynamicClaimsPrincipalContributorCache IdentityDynamicClaimsPrincipalContributorCache { get; } - protected IAbpClaimsPrincipalFactory AbpClaimsPrincipalFactory { get; } - protected ICurrentPrincipalAccessor PrincipalAccessor { get; } - - public DynamicClaimsAppService( - IdentityDynamicClaimsPrincipalContributorCache identityDynamicClaimsPrincipalContributorCache, - IAbpClaimsPrincipalFactory abpClaimsPrincipalFactory, - ICurrentPrincipalAccessor principalAccessor) - { - IdentityDynamicClaimsPrincipalContributorCache = identityDynamicClaimsPrincipalContributorCache; - AbpClaimsPrincipalFactory = abpClaimsPrincipalFactory; - PrincipalAccessor = principalAccessor; - } + protected IdentityDynamicClaimsPrincipalContributorCache IdentityDynamicClaimsPrincipalContributorCache { get; } = identityDynamicClaimsPrincipalContributorCache; + protected IAbpClaimsPrincipalFactory AbpClaimsPrincipalFactory { get; } = abpClaimsPrincipalFactory; + protected ICurrentPrincipalAccessor PrincipalAccessor { get; } = principalAccessor; public virtual async Task RefreshAsync() { diff --git a/modules/account/src/Volo.Abp.Account.Application/Volo/Abp/Account/Emailing/AccountEmailer.cs b/modules/account/src/Volo.Abp.Account.Application/Volo/Abp/Account/Emailing/AccountEmailer.cs index 4c5ab17ef39..672540e6fc7 100644 --- a/modules/account/src/Volo.Abp.Account.Application/Volo/Abp/Account/Emailing/AccountEmailer.cs +++ b/modules/account/src/Volo.Abp.Account.Application/Volo/Abp/Account/Emailing/AccountEmailer.cs @@ -15,27 +15,18 @@ namespace Volo.Abp.Account.Emailing; -public class AccountEmailer : IAccountEmailer, ITransientDependency +public class AccountEmailer( + IEmailSender emailSender, + ITemplateRenderer templateRenderer, + IStringLocalizer stringLocalizer, + IAppUrlProvider appUrlProvider, + ICurrentTenant currentTenant) : IAccountEmailer, ITransientDependency { - protected ITemplateRenderer TemplateRenderer { get; } - protected IEmailSender EmailSender { get; } - protected IStringLocalizer StringLocalizer { get; } - protected IAppUrlProvider AppUrlProvider { get; } - protected ICurrentTenant CurrentTenant { get; } - - public AccountEmailer( - IEmailSender emailSender, - ITemplateRenderer templateRenderer, - IStringLocalizer stringLocalizer, - IAppUrlProvider appUrlProvider, - ICurrentTenant currentTenant) - { - EmailSender = emailSender; - StringLocalizer = stringLocalizer; - AppUrlProvider = appUrlProvider; - CurrentTenant = currentTenant; - TemplateRenderer = templateRenderer; - } + protected ITemplateRenderer TemplateRenderer { get; } = templateRenderer; + protected IEmailSender EmailSender { get; } = emailSender; + protected IStringLocalizer StringLocalizer { get; } = stringLocalizer; + protected IAppUrlProvider AppUrlProvider { get; } = appUrlProvider; + protected ICurrentTenant CurrentTenant { get; } = currentTenant; public virtual async Task SendPasswordResetLinkAsync( IdentityUser user, diff --git a/modules/account/src/Volo.Abp.Account.Application/Volo/Abp/Account/Emailing/AppUrlProviderAccountExtensions.cs b/modules/account/src/Volo.Abp.Account.Application/Volo/Abp/Account/Emailing/AppUrlProviderAccountExtensions.cs index 150ac33e3d6..7c29632a5ef 100644 --- a/modules/account/src/Volo.Abp.Account.Application/Volo/Abp/Account/Emailing/AppUrlProviderAccountExtensions.cs +++ b/modules/account/src/Volo.Abp.Account.Application/Volo/Abp/Account/Emailing/AppUrlProviderAccountExtensions.cs @@ -5,8 +5,6 @@ namespace Volo.Abp.Account.Emailing; public static class AppUrlProviderAccountExtensions { - public static Task GetResetPasswordUrlAsync(this IAppUrlProvider appUrlProvider, string appName) - { - return appUrlProvider.GetUrlAsync(appName, AccountUrlNames.PasswordReset); - } + public static Task GetResetPasswordUrlAsync(this IAppUrlProvider appUrlProvider, string appName) => + appUrlProvider.GetUrlAsync(appName, AccountUrlNames.PasswordReset); } diff --git a/modules/account/src/Volo.Abp.Account.Application/Volo/Abp/Account/Emailing/Templates/AccountEmailTemplateDefinitionProvider.cs b/modules/account/src/Volo.Abp.Account.Application/Volo/Abp/Account/Emailing/Templates/AccountEmailTemplateDefinitionProvider.cs index d1e0cb20e63..66c30710d4d 100644 --- a/modules/account/src/Volo.Abp.Account.Application/Volo/Abp/Account/Emailing/Templates/AccountEmailTemplateDefinitionProvider.cs +++ b/modules/account/src/Volo.Abp.Account.Application/Volo/Abp/Account/Emailing/Templates/AccountEmailTemplateDefinitionProvider.cs @@ -7,9 +7,7 @@ namespace Volo.Abp.Account.Emailing.Templates; public class AccountEmailTemplateDefinitionProvider : TemplateDefinitionProvider { - public override void Define(ITemplateDefinitionContext context) - { - context.Add( + public override void Define(ITemplateDefinitionContext context) => context.Add( new TemplateDefinition( AccountEmailTemplates.PasswordResetLink, displayName: LocalizableString.Create($"TextTemplate:{AccountEmailTemplates.PasswordResetLink}"), @@ -17,5 +15,4 @@ public override void Define(ITemplateDefinitionContext context) localizationResource: typeof(AccountResource) ).WithVirtualFilePath("/Volo/Abp/Account/Emailing/Templates/PasswordResetLink.tpl", true) ); - } } diff --git a/modules/account/src/Volo.Abp.Account.Application/Volo/Abp/Account/ProfileAppService.cs b/modules/account/src/Volo.Abp.Account.Application/Volo/Abp/Account/ProfileAppService.cs index 9749a607d59..d4c5d4fb26f 100644 --- a/modules/account/src/Volo.Abp.Account.Application/Volo/Abp/Account/ProfileAppService.cs +++ b/modules/account/src/Volo.Abp.Account.Application/Volo/Abp/Account/ProfileAppService.cs @@ -14,18 +14,12 @@ namespace Volo.Abp.Account; [Authorize] -public class ProfileAppService : IdentityAppServiceBase, IProfileAppService +public class ProfileAppService( + IdentityUserManager userManager, + IOptions identityOptions) : IdentityAppServiceBase, IProfileAppService { - protected IdentityUserManager UserManager { get; } - protected IOptions IdentityOptions { get; } - - public ProfileAppService( - IdentityUserManager userManager, - IOptions identityOptions) - { - UserManager = userManager; - IdentityOptions = identityOptions; - } + protected IdentityUserManager UserManager { get; } = userManager; + protected IOptions IdentityOptions { get; } = identityOptions; public virtual async Task GetAsync() { diff --git a/modules/account/src/Volo.Abp.Account.Application/Volo/Abp/Account/Settings/AccountSettingDefinitionProvider.cs b/modules/account/src/Volo.Abp.Account.Application/Volo/Abp/Account/Settings/AccountSettingDefinitionProvider.cs index 7e5119a8a4d..cdb78a408b8 100644 --- a/modules/account/src/Volo.Abp.Account.Application/Volo/Abp/Account/Settings/AccountSettingDefinitionProvider.cs +++ b/modules/account/src/Volo.Abp.Account.Application/Volo/Abp/Account/Settings/AccountSettingDefinitionProvider.cs @@ -25,8 +25,5 @@ public override void Define(ISettingDefinitionContext context) ); } - private static LocalizableString L(string name) - { - return LocalizableString.Create(name); - } + private static LocalizableString L(string name) => LocalizableString.Create(name); } diff --git a/modules/account/src/Volo.Abp.Account.Blazor/AbpAccountBlazorModule.cs b/modules/account/src/Volo.Abp.Account.Blazor/AbpAccountBlazorModule.cs index 61b42e18074..6cf269fb370 100644 --- a/modules/account/src/Volo.Abp.Account.Blazor/AbpAccountBlazorModule.cs +++ b/modules/account/src/Volo.Abp.Account.Blazor/AbpAccountBlazorModule.cs @@ -40,8 +40,7 @@ public override void ConfigureServices(ServiceConfigurationContext context) }); } - public override void PostConfigureServices(ServiceConfigurationContext context) - { + public override void PostConfigureServices(ServiceConfigurationContext context)=> OneTimeRunner.Run(() => { ModuleExtensionConfigurationHelper @@ -51,5 +50,5 @@ public override void PostConfigureServices(ServiceConfigurationContext context) editFormTypes: new[] { typeof(PersonalInfoModel) } ); }); - } + } diff --git a/modules/account/src/Volo.Abp.Account.HttpApi.Client/ClientProxies/Volo/Abp/Account/AccountClientProxy.Generated.cs b/modules/account/src/Volo.Abp.Account.HttpApi.Client/ClientProxies/Volo/Abp/Account/AccountClientProxy.Generated.cs index 7016b5f8ea3..91f58bd5ab2 100644 --- a/modules/account/src/Volo.Abp.Account.HttpApi.Client/ClientProxies/Volo/Abp/Account/AccountClientProxy.Generated.cs +++ b/modules/account/src/Volo.Abp.Account.HttpApi.Client/ClientProxies/Volo/Abp/Account/AccountClientProxy.Generated.cs @@ -18,35 +18,27 @@ namespace Volo.Abp.Account; [ExposeServices(typeof(IAccountAppService), typeof(AccountClientProxy))] public partial class AccountClientProxy : ClientProxyBase, IAccountAppService { - public virtual async Task RegisterAsync(RegisterDto input) - { - return await RequestAsync(nameof(RegisterAsync), new ClientProxyRequestTypeValue + public virtual async Task RegisterAsync(RegisterDto input) => + await RequestAsync(nameof(RegisterAsync), new ClientProxyRequestTypeValue { { typeof(RegisterDto), input } }); - } - public virtual async Task SendPasswordResetCodeAsync(SendPasswordResetCodeDto input) - { + public virtual async Task SendPasswordResetCodeAsync(SendPasswordResetCodeDto input) => await RequestAsync(nameof(SendPasswordResetCodeAsync), new ClientProxyRequestTypeValue { { typeof(SendPasswordResetCodeDto), input } }); - } - public virtual async Task VerifyPasswordResetTokenAsync(VerifyPasswordResetTokenInput input) - { - return await RequestAsync(nameof(VerifyPasswordResetTokenAsync), new ClientProxyRequestTypeValue + public virtual async Task VerifyPasswordResetTokenAsync(VerifyPasswordResetTokenInput input) => + await RequestAsync(nameof(VerifyPasswordResetTokenAsync), new ClientProxyRequestTypeValue { { typeof(VerifyPasswordResetTokenInput), input } }); - } - public virtual async Task ResetPasswordAsync(ResetPasswordDto input) - { + public virtual async Task ResetPasswordAsync(ResetPasswordDto input) => await RequestAsync(nameof(ResetPasswordAsync), new ClientProxyRequestTypeValue { { typeof(ResetPasswordDto), input } }); - } } diff --git a/modules/account/src/Volo.Abp.Account.HttpApi.Client/ClientProxies/Volo/Abp/Account/DynamicClaimsClientProxy.Generated.cs b/modules/account/src/Volo.Abp.Account.HttpApi.Client/ClientProxies/Volo/Abp/Account/DynamicClaimsClientProxy.Generated.cs index 7bb80a95cbd..0b28c4fcc4e 100644 --- a/modules/account/src/Volo.Abp.Account.HttpApi.Client/ClientProxies/Volo/Abp/Account/DynamicClaimsClientProxy.Generated.cs +++ b/modules/account/src/Volo.Abp.Account.HttpApi.Client/ClientProxies/Volo/Abp/Account/DynamicClaimsClientProxy.Generated.cs @@ -17,8 +17,5 @@ namespace Volo.Abp.Account; [ExposeServices(typeof(IDynamicClaimsAppService), typeof(DynamicClaimsClientProxy))] public partial class DynamicClaimsClientProxy : ClientProxyBase, IDynamicClaimsAppService { - public virtual async Task RefreshAsync() - { - await RequestAsync(nameof(RefreshAsync)); - } + public virtual async Task RefreshAsync() => await RequestAsync(nameof(RefreshAsync)); } diff --git a/modules/account/src/Volo.Abp.Account.HttpApi.Client/ClientProxies/Volo/Abp/Account/IdentityUserDto.cs b/modules/account/src/Volo.Abp.Account.HttpApi.Client/ClientProxies/Volo/Abp/Account/IdentityUserDto.cs new file mode 100644 index 00000000000..227b2446269 --- /dev/null +++ b/modules/account/src/Volo.Abp.Account.HttpApi.Client/ClientProxies/Volo/Abp/Account/IdentityUserDto.cs @@ -0,0 +1,6 @@ +// This file is automatically generated by ABP framework to use MVC Controllers from CSharp +namespace Volo.Abp.Account; + +public class IdentityUserDto +{ +} \ No newline at end of file diff --git a/modules/account/src/Volo.Abp.Account.HttpApi.Client/ClientProxies/Volo/Abp/Account/ProfileClientProxy.Generated.cs b/modules/account/src/Volo.Abp.Account.HttpApi.Client/ClientProxies/Volo/Abp/Account/ProfileClientProxy.Generated.cs index 61645305538..6e3d29f7add 100644 --- a/modules/account/src/Volo.Abp.Account.HttpApi.Client/ClientProxies/Volo/Abp/Account/ProfileClientProxy.Generated.cs +++ b/modules/account/src/Volo.Abp.Account.HttpApi.Client/ClientProxies/Volo/Abp/Account/ProfileClientProxy.Generated.cs @@ -17,24 +17,17 @@ namespace Volo.Abp.Account; [ExposeServices(typeof(IProfileAppService), typeof(ProfileClientProxy))] public partial class ProfileClientProxy : ClientProxyBase, IProfileAppService { - public virtual async Task GetAsync() - { - return await RequestAsync(nameof(GetAsync)); - } + public virtual async Task GetAsync() => await RequestAsync(nameof(GetAsync)); - public virtual async Task UpdateAsync(UpdateProfileDto input) - { - return await RequestAsync(nameof(UpdateAsync), new ClientProxyRequestTypeValue + public virtual async Task UpdateAsync(UpdateProfileDto input) => + await RequestAsync(nameof(UpdateAsync), new ClientProxyRequestTypeValue { { typeof(UpdateProfileDto), input } }); - } - public virtual async Task ChangePasswordAsync(ChangePasswordInput input) - { + public virtual async Task ChangePasswordAsync(ChangePasswordInput input) => await RequestAsync(nameof(ChangePasswordAsync), new ClientProxyRequestTypeValue { { typeof(ChangePasswordInput), input } }); - } } diff --git a/modules/account/src/Volo.Abp.Account.HttpApi/Volo/Abp/Account/AbpAccountHttpApiModule.cs b/modules/account/src/Volo.Abp.Account.HttpApi/Volo/Abp/Account/AbpAccountHttpApiModule.cs index 6524910ccdd..bf2e5f1ad24 100644 --- a/modules/account/src/Volo.Abp.Account.HttpApi/Volo/Abp/Account/AbpAccountHttpApiModule.cs +++ b/modules/account/src/Volo.Abp.Account.HttpApi/Volo/Abp/Account/AbpAccountHttpApiModule.cs @@ -14,21 +14,19 @@ namespace Volo.Abp.Account; typeof(AbpAspNetCoreMvcModule))] public class AbpAccountHttpApiModule : AbpModule { - public override void PreConfigureServices(ServiceConfigurationContext context) - { + public override void PreConfigureServices(ServiceConfigurationContext context)=> PreConfigure(mvcBuilder => { mvcBuilder.AddApplicationPartIfNotExists(typeof(AbpAccountHttpApiModule).Assembly); }); - } + - public override void ConfigureServices(ServiceConfigurationContext context) - { + public override void ConfigureServices(ServiceConfigurationContext context)=> Configure(options => { options.Resources .Get() .AddBaseTypes(typeof(AbpUiResource)); }); - } + } diff --git a/modules/account/src/Volo.Abp.Account.HttpApi/Volo/Abp/Account/AccountController.cs b/modules/account/src/Volo.Abp.Account.HttpApi/Volo/Abp/Account/AccountController.cs index 14f3554a142..e61f8eb1f8f 100644 --- a/modules/account/src/Volo.Abp.Account.HttpApi/Volo/Abp/Account/AccountController.cs +++ b/modules/account/src/Volo.Abp.Account.HttpApi/Volo/Abp/Account/AccountController.cs @@ -8,40 +8,27 @@ namespace Volo.Abp.Account; [RemoteService(Name = AccountRemoteServiceConsts.RemoteServiceName)] [Area(AccountRemoteServiceConsts.ModuleName)] [Route("api/account")] -public class AccountController : AbpControllerBase, IAccountAppService +public class AccountController(IAccountAppService accountAppService) : AbpControllerBase, IAccountAppService { - protected IAccountAppService AccountAppService { get; } - - public AccountController(IAccountAppService accountAppService) - { - AccountAppService = accountAppService; - } + protected IAccountAppService AccountAppService { get; } = accountAppService; [HttpPost] [Route("register")] - public virtual Task RegisterAsync(RegisterDto input) - { - return AccountAppService.RegisterAsync(input); - } + public virtual Task RegisterAsync(RegisterDto input) => + AccountAppService.RegisterAsync(input); [HttpPost] [Route("send-password-reset-code")] - public virtual Task SendPasswordResetCodeAsync(SendPasswordResetCodeDto input) - { - return AccountAppService.SendPasswordResetCodeAsync(input); - } + public virtual Task SendPasswordResetCodeAsync(SendPasswordResetCodeDto input) => + AccountAppService.SendPasswordResetCodeAsync(input); [HttpPost] [Route("verify-password-reset-token")] - public virtual Task VerifyPasswordResetTokenAsync(VerifyPasswordResetTokenInput input) - { - return AccountAppService.VerifyPasswordResetTokenAsync(input); - } + public virtual Task VerifyPasswordResetTokenAsync(VerifyPasswordResetTokenInput input) => + AccountAppService.VerifyPasswordResetTokenAsync(input); [HttpPost] [Route("reset-password")] - public virtual Task ResetPasswordAsync(ResetPasswordDto input) - { - return AccountAppService.ResetPasswordAsync(input); - } + public virtual Task ResetPasswordAsync(ResetPasswordDto input) => + AccountAppService.ResetPasswordAsync(input); } diff --git a/modules/account/src/Volo.Abp.Account.HttpApi/Volo/Abp/Account/DynamicClaimsController.cs b/modules/account/src/Volo.Abp.Account.HttpApi/Volo/Abp/Account/DynamicClaimsController.cs index 086f524d396..103e4375aa6 100644 --- a/modules/account/src/Volo.Abp.Account.HttpApi/Volo/Abp/Account/DynamicClaimsController.cs +++ b/modules/account/src/Volo.Abp.Account.HttpApi/Volo/Abp/Account/DynamicClaimsController.cs @@ -10,19 +10,11 @@ namespace Volo.Abp.Account; [Area(AccountRemoteServiceConsts.ModuleName)] [ControllerName("DynamicClaims")] [Route("/api/account/dynamic-claims")] -public class DynamicClaimsController : AbpControllerBase, IDynamicClaimsAppService +public class DynamicClaimsController(IDynamicClaimsAppService dynamicClaimsAppService) : AbpControllerBase, IDynamicClaimsAppService { - protected IDynamicClaimsAppService DynamicClaimsAppService { get; } - - public DynamicClaimsController(IDynamicClaimsAppService dynamicClaimsAppService) - { - DynamicClaimsAppService = dynamicClaimsAppService; - } + protected IDynamicClaimsAppService DynamicClaimsAppService { get; } = dynamicClaimsAppService; [HttpPost] [Route("refresh")] - public virtual Task RefreshAsync() - { - return DynamicClaimsAppService.RefreshAsync(); - } + public virtual Task RefreshAsync() => DynamicClaimsAppService.RefreshAsync(); } diff --git a/modules/account/src/Volo.Abp.Account.HttpApi/Volo/Abp/Account/IdentityUserDto.cs b/modules/account/src/Volo.Abp.Account.HttpApi/Volo/Abp/Account/IdentityUserDto.cs new file mode 100644 index 00000000000..3c601c495e7 --- /dev/null +++ b/modules/account/src/Volo.Abp.Account.HttpApi/Volo/Abp/Account/IdentityUserDto.cs @@ -0,0 +1,5 @@ +namespace Volo.Abp.Account; + +public class IdentityUserDto +{ +} \ No newline at end of file diff --git a/modules/account/src/Volo.Abp.Account.HttpApi/Volo/Abp/Account/ProfileController.cs b/modules/account/src/Volo.Abp.Account.HttpApi/Volo/Abp/Account/ProfileController.cs index 6af9ce56d2a..bc5cb7eaed3 100644 --- a/modules/account/src/Volo.Abp.Account.HttpApi/Volo/Abp/Account/ProfileController.cs +++ b/modules/account/src/Volo.Abp.Account.HttpApi/Volo/Abp/Account/ProfileController.cs @@ -9,31 +9,17 @@ namespace Volo.Abp.Account; [Area(AccountRemoteServiceConsts.ModuleName)] [ControllerName("Profile")] [Route("/api/account/my-profile")] -public class ProfileController : AbpControllerBase, IProfileAppService +public class ProfileController(IProfileAppService profileAppService) : AbpControllerBase, IProfileAppService { - protected IProfileAppService ProfileAppService { get; } - - public ProfileController(IProfileAppService profileAppService) - { - ProfileAppService = profileAppService; - } + protected IProfileAppService ProfileAppService { get; } = profileAppService; [HttpGet] - public virtual Task GetAsync() - { - return ProfileAppService.GetAsync(); - } + public virtual Task GetAsync() => ProfileAppService.GetAsync(); [HttpPut] - public virtual Task UpdateAsync(UpdateProfileDto input) - { - return ProfileAppService.UpdateAsync(input); - } + public virtual Task UpdateAsync(UpdateProfileDto input) => ProfileAppService.UpdateAsync(input); [HttpPost] [Route("change-password")] - public virtual Task ChangePasswordAsync(ChangePasswordInput input) - { - return ProfileAppService.ChangePasswordAsync(input); - } + public virtual Task ChangePasswordAsync(ChangePasswordInput input) => ProfileAppService.ChangePasswordAsync(input); } diff --git a/modules/account/src/Volo.Abp.Account.Installer/Volo/Abp/Account/AbpAccountInstallerModule.cs b/modules/account/src/Volo.Abp.Account.Installer/Volo/Abp/Account/AbpAccountInstallerModule.cs index 01d2fa0e3f2..db12d324e23 100644 --- a/modules/account/src/Volo.Abp.Account.Installer/Volo/Abp/Account/AbpAccountInstallerModule.cs +++ b/modules/account/src/Volo.Abp.Account.Installer/Volo/Abp/Account/AbpAccountInstallerModule.cs @@ -8,11 +8,10 @@ namespace Volo.Abp.Account; )] public class AbpAccountInstallerModule : AbpModule { - public override void ConfigureServices(ServiceConfigurationContext context) - { + public override void ConfigureServices(ServiceConfigurationContext context)=> Configure(options => { options.FileSets.AddEmbedded(); }); - } + } diff --git a/modules/account/src/Volo.Abp.Account.Installer/Volo/Abp/Account/ServiceConfigurationContext.cs b/modules/account/src/Volo.Abp.Account.Installer/Volo/Abp/Account/ServiceConfigurationContext.cs new file mode 100644 index 00000000000..5b96991f4ec --- /dev/null +++ b/modules/account/src/Volo.Abp.Account.Installer/Volo/Abp/Account/ServiceConfigurationContext.cs @@ -0,0 +1,5 @@ +namespace Volo.Abp.Account; + +public class ServiceConfigurationContext +{ +} \ No newline at end of file diff --git a/modules/account/src/Volo.Abp.Account.Web.IdentityServer/Areas/Account/Controllers/ErrorController.cs b/modules/account/src/Volo.Abp.Account.Web.IdentityServer/Areas/Account/Controllers/ErrorController.cs index e684fa0c36d..575b470e014 100644 --- a/modules/account/src/Volo.Abp.Account.Web.IdentityServer/Areas/Account/Controllers/ErrorController.cs +++ b/modules/account/src/Volo.Abp.Account.Web.IdentityServer/Areas/Account/Controllers/ErrorController.cs @@ -15,21 +15,14 @@ namespace Volo.Abp.Account.Web.Areas.Account.Controllers; [Area("account")] -public class ErrorController : AbpController +public class ErrorController( + IIdentityServerInteractionService interaction, + IWebHostEnvironment environment, + IOptions abpErrorPageOptions) : AbpController { - private readonly IIdentityServerInteractionService _interaction; - private readonly IWebHostEnvironment _environment; - private readonly AbpErrorPageOptions _abpErrorPageOptions; - - public ErrorController( - IIdentityServerInteractionService interaction, - IWebHostEnvironment environment, - IOptions abpErrorPageOptions) - { - _interaction = interaction; - _environment = environment; - _abpErrorPageOptions = abpErrorPageOptions.Value; - } + private readonly IIdentityServerInteractionService _interaction = interaction; + private readonly IWebHostEnvironment _environment = environment; + private readonly AbpErrorPageOptions _abpErrorPageOptions = abpErrorPageOptions.Value; public virtual async Task Index(string errorId) { diff --git a/modules/account/src/Volo.Abp.Account.Web.IdentityServer/Pages/Account/IdentityServerSupportedLoginModel.cs b/modules/account/src/Volo.Abp.Account.Web.IdentityServer/Pages/Account/IdentityServerSupportedLoginModel.cs index 0a2aadd64a1..b8c704a38a0 100644 --- a/modules/account/src/Volo.Abp.Account.Web.IdentityServer/Pages/Account/IdentityServerSupportedLoginModel.cs +++ b/modules/account/src/Volo.Abp.Account.Web.IdentityServer/Pages/Account/IdentityServerSupportedLoginModel.cs @@ -22,26 +22,18 @@ namespace Volo.Abp.Account.Web.Pages.Account; [ExposeServices(typeof(LoginModel))] -public class IdentityServerSupportedLoginModel : LoginModel +public class IdentityServerSupportedLoginModel( + IAuthenticationSchemeProvider schemeProvider, + IOptions accountOptions, + IOptions identityOptions, + IdentityDynamicClaimsPrincipalContributorCache identityDynamicClaimsPrincipalContributorCache, + IIdentityServerInteractionService interaction, + IClientStore clientStore, + IEventService identityServerEvents) : LoginModel(schemeProvider, accountOptions, identityOptions, identityDynamicClaimsPrincipalContributorCache) { - protected IIdentityServerInteractionService Interaction { get; } - protected IClientStore ClientStore { get; } - protected IEventService IdentityServerEvents { get; } - - public IdentityServerSupportedLoginModel( - IAuthenticationSchemeProvider schemeProvider, - IOptions accountOptions, - IOptions identityOptions, - IdentityDynamicClaimsPrincipalContributorCache identityDynamicClaimsPrincipalContributorCache, - IIdentityServerInteractionService interaction, - IClientStore clientStore, - IEventService identityServerEvents) - : base(schemeProvider, accountOptions, identityOptions, identityDynamicClaimsPrincipalContributorCache) - { - Interaction = interaction; - ClientStore = clientStore; - IdentityServerEvents = identityServerEvents; - } + protected IIdentityServerInteractionService Interaction { get; } = interaction; + protected IClientStore ClientStore { get; } = clientStore; + protected IEventService IdentityServerEvents { get; } = identityServerEvents; public override async Task OnGetAsync() { diff --git a/modules/account/src/Volo.Abp.Account.Web.IdentityServer/Pages/Account/IdentityServerSupportedLogoutModel.cs b/modules/account/src/Volo.Abp.Account.Web.IdentityServer/Pages/Account/IdentityServerSupportedLogoutModel.cs index 2ea814c8a90..73ac365f19f 100644 --- a/modules/account/src/Volo.Abp.Account.Web.IdentityServer/Pages/Account/IdentityServerSupportedLogoutModel.cs +++ b/modules/account/src/Volo.Abp.Account.Web.IdentityServer/Pages/Account/IdentityServerSupportedLogoutModel.cs @@ -9,14 +9,9 @@ namespace Volo.Abp.Account.Web.Pages.Account; [ExposeServices(typeof(LogoutModel))] -public class IdentityServerSupportedLogoutModel : LogoutModel +public class IdentityServerSupportedLogoutModel(IIdentityServerInteractionService interaction) : LogoutModel { - protected IIdentityServerInteractionService Interaction { get; } - - public IdentityServerSupportedLogoutModel(IIdentityServerInteractionService interaction) - { - Interaction = interaction; - } + protected IIdentityServerInteractionService Interaction { get; } = interaction; public async override Task OnGetAsync() { diff --git a/modules/account/src/Volo.Abp.Account.Web.IdentityServer/Properties/launchSettings.json b/modules/account/src/Volo.Abp.Account.Web.IdentityServer/Properties/launchSettings.json new file mode 100644 index 00000000000..bffb0e4be63 --- /dev/null +++ b/modules/account/src/Volo.Abp.Account.Web.IdentityServer/Properties/launchSettings.json @@ -0,0 +1,12 @@ +{ + "profiles": { + "Volo.Abp.Account.Web.IdentityServer": { + "commandName": "Project", + "launchBrowser": true, + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + }, + "applicationUrl": "https://localhost:60033;http://localhost:60034" + } + } +} \ No newline at end of file diff --git a/modules/account/src/Volo.Abp.Account.Web.OpenIddict/AbpAccountWebOpenIddictModule.cs b/modules/account/src/Volo.Abp.Account.Web.OpenIddict/AbpAccountWebOpenIddictModule.cs index 7a81943dd39..dd78ed86e56 100644 --- a/modules/account/src/Volo.Abp.Account.Web.OpenIddict/AbpAccountWebOpenIddictModule.cs +++ b/modules/account/src/Volo.Abp.Account.Web.OpenIddict/AbpAccountWebOpenIddictModule.cs @@ -11,19 +11,18 @@ namespace Volo.Abp.Account.Web; )] public class AbpAccountWebOpenIddictModule : AbpModule { - public override void PreConfigureServices(ServiceConfigurationContext context) - { + public override void PreConfigureServices(ServiceConfigurationContext context)=> + PreConfigure(mvcBuilder => { mvcBuilder.AddApplicationPartIfNotExists(typeof(AbpAccountWebOpenIddictModule).Assembly); }); - } + - public override void ConfigureServices(ServiceConfigurationContext context) - { + public override void ConfigureServices(ServiceConfigurationContext context)=> Configure(options => { options.FileSets.AddEmbedded(); }); - } + } diff --git a/modules/account/src/Volo.Abp.Account.Web.OpenIddict/Properties/launchSettings.json b/modules/account/src/Volo.Abp.Account.Web.OpenIddict/Properties/launchSettings.json new file mode 100644 index 00000000000..18b4f506740 --- /dev/null +++ b/modules/account/src/Volo.Abp.Account.Web.OpenIddict/Properties/launchSettings.json @@ -0,0 +1,12 @@ +{ + "profiles": { + "Volo.Abp.Account.Web.OpenIddict": { + "commandName": "Project", + "launchBrowser": true, + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + }, + "applicationUrl": "https://localhost:60036;http://localhost:60037" + } + } +} \ No newline at end of file diff --git a/modules/account/src/Volo.Abp.Account.Web/AbpAccountOptions.cs b/modules/account/src/Volo.Abp.Account.Web/AbpAccountOptions.cs index cbe86acba90..6e5f0756d1b 100644 --- a/modules/account/src/Volo.Abp.Account.Web/AbpAccountOptions.cs +++ b/modules/account/src/Volo.Abp.Account.Web/AbpAccountOptions.cs @@ -7,9 +7,7 @@ public class AbpAccountOptions /// public string WindowsAuthenticationSchemeName { get; set; } - public AbpAccountOptions() - { + public AbpAccountOptions() => //TODO: This makes us depend on the Microsoft.AspNetCore.Server.IISIntegration package. WindowsAuthenticationSchemeName = "Windows"; //Microsoft.AspNetCore.Server.IISIntegration.IISDefaults.AuthenticationScheme; - } } diff --git a/modules/account/src/Volo.Abp.Account.Web/AbpAccountWebAutomapperProfile.cs b/modules/account/src/Volo.Abp.Account.Web/AbpAccountWebAutomapperProfile.cs index cdc92e8b19d..adfd745e610 100644 --- a/modules/account/src/Volo.Abp.Account.Web/AbpAccountWebAutomapperProfile.cs +++ b/modules/account/src/Volo.Abp.Account.Web/AbpAccountWebAutomapperProfile.cs @@ -7,9 +7,7 @@ namespace Volo.Abp.Account.Web; public class AbpAccountWebAutoMapperProfile : Profile { - public AbpAccountWebAutoMapperProfile() - { + public AbpAccountWebAutoMapperProfile() => CreateMap() .MapExtraProperties(); - } } diff --git a/modules/account/src/Volo.Abp.Account.Web/AbpAccountWebModule.cs b/modules/account/src/Volo.Abp.Account.Web/AbpAccountWebModule.cs index 9f670ffc824..f7aaf75d6c6 100644 --- a/modules/account/src/Volo.Abp.Account.Web/AbpAccountWebModule.cs +++ b/modules/account/src/Volo.Abp.Account.Web/AbpAccountWebModule.cs @@ -102,8 +102,7 @@ private void ConfigureProfileManagementPage() } - public override void PostConfigureServices(ServiceConfigurationContext context) - { + public override void PostConfigureServices(ServiceConfigurationContext context)=> OneTimeRunner.Run(() => { ModuleExtensionConfigurationHelper @@ -113,5 +112,5 @@ public override void PostConfigureServices(ServiceConfigurationContext context) editFormTypes: new[] { typeof(AccountProfilePersonalInfoManagementGroupViewComponent.PersonalInfoModel) } ); }); - } + } diff --git a/modules/account/src/Volo.Abp.Account.Web/Areas/Account/Controllers/AccountController.cs b/modules/account/src/Volo.Abp.Account.Web/Areas/Account/Controllers/AccountController.cs index 6ab60e7ee45..5937b63a2d7 100644 --- a/modules/account/src/Volo.Abp.Account.Web/Areas/Account/Controllers/AccountController.cs +++ b/modules/account/src/Volo.Abp.Account.Web/Areas/Account/Controllers/AccountController.cs @@ -105,10 +105,7 @@ await IdentitySecurityLogManager.SaveAsync(new IdentitySecurityLogContext() [HttpPost] [Route("checkPassword")] [ApiExplorerSettings(IgnoreApi = true)] - public virtual Task CheckPasswordCompatible(UserLoginInfo login) - { - return CheckPassword(login); - } + public virtual Task CheckPasswordCompatible(UserLoginInfo login) => CheckPassword(login); [HttpPost] [Route("check-password")] diff --git a/modules/account/src/Volo.Abp.Account.Web/Areas/Account/Controllers/Models/AbpLoginResult.cs b/modules/account/src/Volo.Abp.Account.Web/Areas/Account/Controllers/Models/AbpLoginResult.cs index 287c9cc6da4..53f9dcba581 100644 --- a/modules/account/src/Volo.Abp.Account.Web/Areas/Account/Controllers/Models/AbpLoginResult.cs +++ b/modules/account/src/Volo.Abp.Account.Web/Areas/Account/Controllers/Models/AbpLoginResult.cs @@ -1,13 +1,8 @@ namespace Volo.Abp.Account.Web.Areas.Account.Controllers.Models; -public class AbpLoginResult +public class AbpLoginResult(LoginResultType result) { - public AbpLoginResult(LoginResultType result) - { - Result = result; - } - - public LoginResultType Result { get; } + public LoginResultType Result { get; } = result; public string Description => Result.ToString(); } diff --git a/modules/account/src/Volo.Abp.Account.Web/Modules/Account/Components/Toolbar/UserLoginLink/UserLoginLinkViewComponent.cs b/modules/account/src/Volo.Abp.Account.Web/Modules/Account/Components/Toolbar/UserLoginLink/UserLoginLinkViewComponent.cs index 1180b6e4540..534ccd23884 100644 --- a/modules/account/src/Volo.Abp.Account.Web/Modules/Account/Components/Toolbar/UserLoginLink/UserLoginLinkViewComponent.cs +++ b/modules/account/src/Volo.Abp.Account.Web/Modules/Account/Components/Toolbar/UserLoginLink/UserLoginLinkViewComponent.cs @@ -5,8 +5,6 @@ namespace Volo.Abp.Account.Web.Modules.Account.Components.Toolbar.UserLoginLink; public class UserLoginLinkViewComponent : AbpViewComponent { - public virtual IViewComponentResult Invoke() - { - return View("~/Modules/Account/Components/Toolbar/UserLoginLink/Default.cshtml"); - } + public virtual IViewComponentResult Invoke() => + View("~/Modules/Account/Components/Toolbar/UserLoginLink/Default.cshtml"); } diff --git a/modules/account/src/Volo.Abp.Account.Web/Pages/Account/Components/ProfileManagementGroup/Password/AccountProfilePasswordManagementGroupViewComponent.cs b/modules/account/src/Volo.Abp.Account.Web/Pages/Account/Components/ProfileManagementGroup/Password/AccountProfilePasswordManagementGroupViewComponent.cs index 73246a58749..5d112d32dad 100644 --- a/modules/account/src/Volo.Abp.Account.Web/Pages/Account/Components/ProfileManagementGroup/Password/AccountProfilePasswordManagementGroupViewComponent.cs +++ b/modules/account/src/Volo.Abp.Account.Web/Pages/Account/Components/ProfileManagementGroup/Password/AccountProfilePasswordManagementGroupViewComponent.cs @@ -9,15 +9,10 @@ namespace Volo.Abp.Account.Web.Pages.Account.Components.ProfileManagementGroup.Password; -public class AccountProfilePasswordManagementGroupViewComponent : AbpViewComponent +public class AccountProfilePasswordManagementGroupViewComponent( + IProfileAppService profileAppService) : AbpViewComponent { - protected IProfileAppService ProfileAppService { get; } - - public AccountProfilePasswordManagementGroupViewComponent( - IProfileAppService profileAppService) - { - ProfileAppService = profileAppService; - } + protected IProfileAppService ProfileAppService { get; } = profileAppService; public virtual async Task InvokeAsync() { diff --git a/modules/account/src/Volo.Abp.Account.Web/ProfileManagement/ProfileManagementPageOptions.cs b/modules/account/src/Volo.Abp.Account.Web/ProfileManagement/ProfileManagementPageOptions.cs index 504c1e34b72..3eba46be6f4 100644 --- a/modules/account/src/Volo.Abp.Account.Web/ProfileManagement/ProfileManagementPageOptions.cs +++ b/modules/account/src/Volo.Abp.Account.Web/ProfileManagement/ProfileManagementPageOptions.cs @@ -6,8 +6,5 @@ public class ProfileManagementPageOptions { public List Contributors { get; } - public ProfileManagementPageOptions() - { - Contributors = new List(); - } + public ProfileManagementPageOptions() => Contributors = new List(); }