Activities of "liangshiwei"

Hi,

You can try this:

[ExposeServices(typeof(RegisterModel))]
public class MyRegisterModel : RegisterModel
{
    public MyRegisterModel(IAuthenticationSchemeProvider schemeProvider, IOptions<AbpAccountOptions> accountOptions, IAccountExternalProviderAppService accountExternalProviderAppService, ICurrentPrincipalAccessor currentPrincipalAccessor, IHttpClientFactory httpClientFactory) : base(schemeProvider, accountOptions, accountExternalProviderAppService, currentPrincipalAccessor, httpClientFactory)
    {
    }

    public override async Task<IActionResult> OnGetAsync()
    {
        ExternalProviders = await GetExternalProviders();
        if (!await CheckSelfRegistrationAsync())
        {
            if (IsExternalLoginOnly)
            {
                return await OnPostExternalLogin(ExternalLoginScheme);
            }

            Alerts.Warning(L["SelfRegistrationDisabledMessage"]);
            return Page();
        }
        
        if (IsExternalLogin)
        {
            var externalLoginInfo = await SignInManager.GetExternalLoginInfoAsync();
            if (externalLoginInfo == null)
            {
                Logger.LogWarning("External login info is not available");
                return RedirectToPage("./Login");
            }

            
            var identity = externalLoginInfo.Principal.Identities.First();
            var emailClaim = identity.FindFirst(AbpClaimTypes.Email) ?? identity.FindFirst(ClaimTypes.Email);
            if (emailClaim == null)
            {
                throw new AbpException("Could not find an email address for the user from the external login info!");
            }

            var userName = await UserManager.GetUserNameFromEmailAsync(emailClaim.Value);
            
            var user = await RegisterExternalUserAsync(externalLoginInfo,userName, emailClaim.Value);
            await SignInManager.SignInAsync(user, isPersistent: true, authenticationMethod: ExternalLoginAuthSchema);

            // Clear the dynamic claims cache.
            await IdentityDynamicClaimsPrincipalContributorCache.ClearAsync(user.Id, user.TenantId);
            return Redirect(ReturnUrl ?? "/"); 
            
        }

        Alerts.Warning(L["SelfRegistrationDisabledMessage"]);
        return Page();
    }
}
Answer

I've explained it here: https://support.abp.io/QA/Questions/6841/more-than-level#answer-3a11428d-7843-2605-31cf-e7cb1d65c00e

This is how ABP does it you can refer to https://github.com/abpframework/abp/blob/dev/modules/permission-management/src/Volo.Abp.PermissionManagement.Web/Pages/AbpPermissionManagement/PermissionManagementModal.cshtml#L47 https://github.com/abpframework/abp/blob/dev/modules/permission-management/src/Volo.Abp.PermissionManagement.Web/Pages/AbpPermissionManagement/PermissionManagementModal.cshtml.cs#L73

You also need to use the JS event to handle parent or child selection https://github.com/abpframework/abp/blob/dev/modules/permission-management/src/Volo.Abp.PermissionManagement.Web/Pages/AbpPermissionManagement/permission-management-modal.js#L8

Hi,

You can create a bot user for the Background Job:

public class MyBackgroundJob : AsyncBackgroundJob<MyBackgroundJobArgs>
{
    private readonly ICurrentPrincipalAccessor _principalAccessor;
    private readonly IdentityUserManager _identityUserManager;

    public MyBackgroundJob(ICurrentPrincipalAccessor principalAccessor, IdentityUserManager identityUserManager)
    {
        _principalAccessor = principalAccessor;
        _identityUserManager = identityUserManager;
    }

    public override async Task ExecuteAsync(MyBackgroundJobArgs args)
    {
        using (_principalAccessor.Change(await CreateBotUserClaimsPrincipalAsync()))
        {
            //....
        }
    }

    private async Task<ClaimsPrincipal> CreateBotUserClaimsPrincipalAsync()
    {
        var user = await  _identityUserManager.FindByNameAsync("Bot User name");
        var roles = await _identityUserManager.GetRolesAsync(user);
        var claims = new List<Claim>
        {
            new Claim(AbpClaimTypes.UserId, user.Id.ToString()),
            new Claim(AbpClaimTypes.UserName, user.UserName),
            new Claim(AbpClaimTypes.Email,user.Email)
        };
        claims.AddRange(roles.Select(x => new Claim(AbpClaimTypes.Role, x)));
        return new ClaimsPrincipal(new ClaimsIdentity(claims));
    }
}
Answer

Hi,

You can refer to the user edit page:

Could you share an example project to reproduce the problem with me via email? I will check it.

my email is shiwei.liang@volosoft.com

It works for me:

public class EmailTemplateDefinitionProvider : TemplateDefinitionProvider
{
    public override void Define(ITemplateDefinitionContext context)
    {
        context.Add(
            new TemplateDefinition(
                    name: EmailTemplateNames.EmailLayout,
                    displayName: new LocalizableString("EmailLayoutTemplate", "LogiPlatResource"),
                    defaultCultureName: "en",
                    isLayout: true)
                .WithVirtualFilePath("/Localization/Template/Layout/email.tpl", isInlineLocalized: true)
                .WithScribanEngine());

        context.Add(
            new TemplateDefinition(
                    name: EmailTemplateNames.StaffEmailConfirmation,
                    layout: EmailTemplateNames.EmailLayout,
                    displayName: new LocalizableString("StaffEmailConfirmationTemplate", "LogiPlatResource"),
                    defaultCultureName: "en")
                .WithVirtualFilePath("/Localization/Template/Register", isInlineLocalized: false)
                .WithScribanEngine());
    }
}
[Route("api/qa/template")]
public class QaTemplateController : QaController
{
    private readonly ITemplateRenderer _templateRenderer;

    public QaTemplateController(ITemplateRenderer templateRenderer)
    {
        _templateRenderer = templateRenderer;
    }
    
    [HttpGet]
    public async  Task<IActionResult> GetStaffEmailConfirmationTemplateAsync()
    {
        return Content( await _templateRenderer.RenderAsync(
            EmailTemplateNames.StaffEmailConfirmation,
            new { }
        ), "text/html");
    }
}

Answer

Hi,

You can change the spacing yourself

This is how ABP does it you can refer to https://github.com/abpframework/abp/blob/dev/modules/permission-management/src/Volo.Abp.PermissionManagement.Web/Pages/AbpPermissionManagement/PermissionManagementModal.cshtml#L47 https://github.com/abpframework/abp/blob/dev/modules/permission-management/src/Volo.Abp.PermissionManagement.Web/Pages/AbpPermissionManagement/PermissionManagementModal.cshtml.cs#L73

Hi,

This is by design, He is registered as an external user.

Hi,

You can check this https://stackoverflow.com/questions/73402839/how-to-get-response-from-the-xml-web-api

Answer

Hi,

You can configure the Polling interval

https://github.com/Xabaril/AspNetCore.Diagnostics.HealthChecks?tab=readme-ov-file#ui-polling-interval

Showing 2311 to 2320 of 6693 entries
Boost Your Development
ABP Live Training
Packages
See Trainings
Mastering ABP Framework Book
The Official Guide
Mastering
ABP Framework
Learn More
Mastering ABP Framework Book
Made with ❤️ on ABP v10.1.0-preview. Updated on November 07, 2025, 08:20