How to add/link additional user info to the newly created users?

Vote:
 

 Currently I am using default Alloy RegisterController using ASP.NET Identity . It is used for Admin Account for the first time only, so I have made some modification to allow general user log in. The method-UIUserProvider.CreateUser  only allows to save username, password, email, passwordQuestion, passwordAnswer, isApproved, UIUserCreateStatus status and errors. How to add/link additional user info to the newly created users? I may have to add additional info during or after registration.

#202832
Apr 02, 2019 9:48
Vote:
 

The UIUserProvider is used for creating user within limitting input information.

If you want to add more infomation freely while registering new user then you could use ApplicationUserManager<ApplicationUser> instead of using UIUserProvider

#202837
Edited, Apr 02, 2019 10:47
Vote:
 

Can you provide simple sample of ApplicationUserManager<ApplicationUser>? The one in QuickSilver is complex and entangled with much code to begin with. I used the code below which gives me null.

 public ApplicationUserManager UserManager
        {
            get
            {
                return _userManager ?? HttpContext.GetOwinContext().GetUserManager<ApplicationUserManager>();
            }
            private set
            {
                _userManager = value;
            }
        }
#202842
Edited, Apr 02, 2019 12:05
Vote:
 

Here is simple sample of  ApplicationUserManager<ApplicationUser> to create a new user

var userManager = ServiceLocator.Current.GetInstance<ApplicationUserManager<ApplicationUser>>();
userManager.Create(new ApplicationUser() {Username = "test", Email = "test@example.com", IsApproved = true}, "Password4Test");
#202843
Apr 02, 2019 12:07
Vote:
 

When I used the code you provided, I am getting the following error.

No default Instance is registered and cannot be automatically determined for type 'IUserStore<ApplicationUser>'

There is no configuration specified for IUserStore<ApplicationUser>

1.) new ApplicationUserManager(*Default of IUserStore<ApplicationUser>*)
2.) ApplicationUserManager
3.) Instance of ApplicationUserManager
4.) Container.GetInstance(Login.ApplicationUserManager)

Exception Details: StructureMap.StructureMapConfigurationException: No default Instance is registered and cannot be automatically determined for type 'IUserStore<ApplicationUser>'

#202863
Edited, Apr 03, 2019 5:06
Vote:
 

It is so weird. I did it successfully before based on this example https://github.com/episerver/QuicksilverB2B/blob/master/Sources/EPiServer.Reference.Commerce.Site/Features/Login/Services/UserService.cs

There may be a change for this stuff with new episerver version. I will try to find out the problem when I have time

#202868
Apr 03, 2019 6:08
Vote:
 

Injecting last two dependencies provided me Usermanager object.

 context.Services.AddTransient<IContentRenderer, ErrorHandlingContentRenderer>()
                    .AddTransient<ContentAreaRenderer, AlloyContentAreaRenderer>()
                    .AddTransient<IUserStore<ApplicationUser>, UserStore<ApplicationUser>>()
                    .AddTransient<DbContext, ApplicationDbContext>();
#202886
Apr 03, 2019 9:39
Vote:
 

Great! You are right. These were not registered automatically by Episerver.

#202896
Edited, Apr 03, 2019 10:31
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.