Learn More, Pay Less!
Limited Time Offer!
Open Closed

Customizing Create User Modal with random password generation #8689


User avatar
0
RobertSCG created

Hello ,

I want to customize the new user modal :

the customization requires adding a random password generation function to the password input in modal , and set initial value for Force password change checkbox.

The random password generation function can be inherited from this feature where we have a button to generate random password:

questions : Which components should be ovewritten to achieve such actions in user creation modal ? From which component should I analyze the code to get the random password generating function ?

  • ABP Framework version: 9.0.2
  • UI Type: Blazor Server
  • Database System: EF Core (SQL Serve)
  • Tiered (for MVC) or Auth Server Separated (for Angular): yes

15 Answer(s)
  • User Avatar
    0
    Anjali_Musmade created
    Support Team Support Team Member

    Hello ,

    Can you create a project in ABP Studio with the latest version where the random password generation functionality is available.

    Thank you.

  • User Avatar
    0
    RobertSCG created

    Hello ,

    i know that this function exsists , but isn't it design to modify exsisting password ?

    my goal is to re-use this function by customizing New User modal

  • User Avatar
    0
    RobertSCG created

    Hellom

    Is there something for Blazor Server like extending a forms ?

  • User Avatar
    0
    sumeyye.kurtulus created
    Support Team Angular Expert

    Hi, I apologize for the confusion regarding Angular ui. I’ve removed my answer, and my teammate will assist you with this moving forward.

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    You need to override the user management.

    Here is the document https://abp.io/docs/latest/framework/ui/blazor/customization-overriding-components

    You can download the source code via abp suite.

  • User Avatar
    0
    RobertSCG created

    Hi , thank You,

    I've copied UserManagement.razor , component into Pages/Identity in my project. I've installed Blazorise.Treeview lib , with the Excubo.Blazor.TreeViews class.

    Unfortunatelly I have some errors in this part of code :

    I cannot resolve @context parameter and for the item :

    I've checked how it is done in You Identity.Pro solution and there is no declaration of this params. Also my IDE do not mark the attributes like "Items" , "HasChildren" like in Your code below :

    somehow my copied component do not "see" this parameters.

    You have some hints maybe ?

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    I've installed Blazorise.Treeview lib , with the Excubo.Blazor.TreeViews class.

    Please remove Blazorise.Treeview

  • User Avatar
    0
    RobertSCG created

    Hi,

    When I will remove Blazorise.Treeview , the components in the code screens like <TreeView , wont be available to resolve the component type. And my solution won't compile. Main error is : [CS0234] The type or namespace name 'TreeView' does not exist in the namespace 'Blazorise' (are you missing an assembly reference?)

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    We use Excubo.Blazor.TreeViews libary, you can install it and add the import to the import.razor

  • User Avatar
    0
    RobertSCG created

    Hi , thanks that helped.

    I'm facing now another issue , from blazor.web.js.

    Error: System.InvalidOperationException: The following routes are ambiguous: 'identity/users' in 'X.Blazor.Components.Pages.Identity.CustomUserManagement' 'identity/users' in 'Volo.Abp.Identity.Pro.Blazor.Pages.Identity.UserManagement'

    in my BlazorModule i have such configuration which registers already all AdditionalAssemblies:

    `app.UseConfiguredEndpoints(builder => {

    var additionalAssemblies = builder.ServiceProvider.GetRequiredService<IOptions>()

    .Value.AdditionalAssemblies.ToArray();

    builder.MapRazorComponents()

    .AddInteractiveServerRenderMode()

    .AddAdditionalAssemblies(additionalAssemblies); });`

    anyway I'm getting this ambigous error. Maybe there is some problem that the route is the same ? ( i want to leave it unchagned )

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    Could you share your code screenshots?

  • User Avatar
    0
    RobertSCG created

    Hi ,

    the code is exactly the same as in Identity.Account.Pro. I have only changed the name for my CustomUserManagement component. This component contains a route for : @page "/identity/users"

    and it is placed in Blazor.csproj in the path Components/Pages/Identity

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    You don't need to add @page "/identity/users"

    https://abp.io/docs/latest/framework/ui/blazor/customization-overriding-components

    CustomUserManagement.razor

    @inherits UserManagement
    
    ...My page
    

    CustomUserManagement.razor.cs

    [ExposeServices(typeof(UserManagement))]
    [Dependency(ReplaceServices = true)]
    public partial class CustomUserManagement
    {
    
    }
    
  • User Avatar
    0
    RobertSCG created

    Hi , thanks very much that helped :)

    One more question regarding UserManagement customization.

    Is there a possibility to add another option for particular user action context menu ?

    I want to add an option for admin , to reset Authenticator for specified user. It can work similar like in example - Set Password feature

    I'm aware that I can user Account App Service but is there a possibility to overwrite this method :

    and reset the authenticator for a particular user for which the context action is performed ?

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    Of course, you can.

    https://abp.io/docs/latest/framework/ui/blazor/entity-action-extensions

    Add a new entity action, you get the userId from the current data row

Made with ❤️ on ABP v9.2.0-preview. Updated on February 13, 2025, 10:35