using LINGYUN.Abp.Account.Security; using LINGYUN.Abp.Account.Web.Bundling; using LINGYUN.Abp.Account.Web.ProfileManagement; using LINGYUN.Abp.Identity; using LINGYUN.Abp.Identity.AspNetCore.QrCode; using Microsoft.AspNetCore.Authentication.Cookies; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Identity; using Microsoft.Extensions.DependencyInjection; using System; using Volo.Abp.Account.Localization; using Volo.Abp.Account.Web.Pages.Account; using Volo.Abp.Account.Web.ProfileManagement; using Volo.Abp.AspNetCore.Mvc.Localization; using Volo.Abp.AspNetCore.Mvc.UI.Bundling; using Volo.Abp.AspNetCore.Mvc.UI.Packages.QRCode; using Volo.Abp.Modularity; using Volo.Abp.Sms; using Volo.Abp.VirtualFileSystem; using VoloAbpAccountWebModule = Volo.Abp.Account.Web.AbpAccountWebModule; namespace LINGYUN.Abp.Account.Web; [DependsOn( typeof(AbpSmsModule), typeof(VoloAbpAccountWebModule), typeof(AbpAccountSecurityModule), typeof(AbpIdentityDomainModule), typeof(AbpIdentityAspNetCoreQrCodeModule), typeof(AbpAccountApplicationContractsModule))] public class AbpAccountWebModule : AbpModule { public override void PreConfigureServices(ServiceConfigurationContext context) { context.Services.PreConfigure(options => { options.AddAssemblyResource(typeof(AccountResource), typeof(AbpAccountWebModule).Assembly); }); PreConfigure(mvcBuilder => { mvcBuilder.AddApplicationPartIfNotExists(typeof(AbpAccountWebModule).Assembly); }); } public override void ConfigureServices(ServiceConfigurationContext context) { Configure(options => { options.FileSets.AddEmbedded(); }); ConfigureProfileManagementPage(); context.Services.AddMapperlyObjectMapper(); context.Services .AddAuthentication() .AddCookie(AbpAccountAuthenticationTypes.ShouldChangePassword, options => { options.LoginPath = new PathString("/Account/Login"); options.ExpireTimeSpan = TimeSpan.FromMinutes(5.0); options.Events = new CookieAuthenticationEvents { OnValidatePrincipal = SecurityStampValidator.ValidatePrincipalAsync }; }); } private void ConfigureProfileManagementPage() { Configure(options => { options.Contributors.Add(new ProfileManagementPageContributor()); }); Configure(options => { options.StyleBundles .Add(AccountBundles.Styles.UserLoginLink, bundle => { bundle.AddContributors(typeof(UserLoginLinkStyleContributor)); }); options.ScriptBundles .Configure(typeof(ManageModel).FullName, bundle => { // Client Proxies bundle.AddFiles("/client-proxies/account-proxy.js"); // Session bundle.AddFiles("/Pages/Account/Components/ProfileManagementGroup/Session/Index.js"); // Authenticator bundle.AddFiles("/Pages/Account/Components/ProfileManagementGroup/Authenticator/Index.js"); // SecurityLog bundle.AddFiles("/Pages/Account/Components/ProfileManagementGroup/SecurityLog/Index.js"); // TwoFactor bundle.AddFiles("/Pages/Account/Components/ProfileManagementGroup/TwoFactor/Default.js"); // QrCode bundle.AddContributors(typeof(QRCodeScriptContributor)); }); options.ScriptBundles .Configure(AccountBundles.Scripts.ChangePassword, bundle => { bundle.AddContributors(typeof(ChangePasswordScriptContributor)); }); options.ScriptBundles .Configure(typeof(Pages.Account.LoginModel).FullName, bundle => { bundle.AddFiles("/client-proxies/account-proxy.js"); bundle.AddFiles("/client-proxies/qrcode-proxy.js"); bundle.AddFiles("/Pages/Account/Login.js"); bundle.AddContributors(typeof(QRCodeScriptContributor)); }); }); } }