Skip to content

Manage users (register a new user, restore a password, etc.) from the login form in XAF Blazor UI

License

Notifications You must be signed in to change notification settings

DevExpress-Examples/XAF_logon-form-manage-users-register-a-new-user-restore-a-password

Repository files navigation

XAF Blazor UI: How to extend the logon form: register a new user, restore a password

Note: Instead of custom implementation, we recommend that you delegate these routine tasks to OAuth2 providers. Microsoft, Google, Azure, and GitHub services enable user and document management that's familiar to anyone who works with business apps. Your XAF application can easily integrate these OAuth2 providers into the logon form. You only need to add boilerplate code. Refer to the following help topic for additional information: Active Directory and OAuth2 Authentication Providers in ASP.NET Core Blazor Applications.

This example contains a reusable Security.Extensions module that implements the capability to register a new user from the login form and the "Forgot Password" feature.

Log In form

The module includes the following notable building blocks:

Implementation Details

Perform the following steps to integrate this module in your project:

  1. Download the Security.Extensions module project and add it to your XAF solution. Reference the module project in your Blazor project and rebuild the solution.

    See the following topic for details: How to: Add Projects to a Solution.

  2. Add the SecurityExtensionsModule to your application:

    File to review: DXApplication1.Blazor.Server/Startup.cs

    public class Startup {
        public void ConfigureServices(IServiceCollection services) {
            services.AddXaf(Configuration, builder => {
                builder.Modules
                    .AddSecurityExtensions(options => options.CreateSecuritySystemUser = DXApplication1.Module.DatabaseUpdate.Updater.CreateUser)
                    // ...
                // ...
            });
            // ...
        }
        // ...
    }

    In the previous code sample, Updater.CreateUser is your custom method that matches the following definition:

    public delegate IAuthenticationStandardUser CreateSecuritySystemUser(IObjectSpace objectSpace, string userName, string email, string password, bool isAdministrator);
  3. Add the Email property to the ApplicationUser class:

    File to review: ApplicationUser.cs

    public class ApplicationUser : /*...*/ {
        // ...
        public virtual string Email { get; set; }
    }

Files to Review

Documentation

More Examples

Does this example address your development requirements/objectives?

(you will be redirected to DevExpress.com to submit your response)