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
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;
}
}
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");
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>'
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
Injecting last two dependencies provided me Usermanager object.
context.Services.AddTransient<IContentRenderer, ErrorHandlingContentRenderer>()
.AddTransient<ContentAreaRenderer, AlloyContentAreaRenderer>()
.AddTransient<IUserStore<ApplicationUser>, UserStore<ApplicationUser>>()
.AddTransient<DbContext, ApplicationDbContext>();
Great! You are right. These were not registered automatically by Episerver.
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.