I have a member login built using UmbracoIdentity.
(https://github.com/Shazwazza/UmbracoIdentity)
The UserManager in the below code is returned as null. I have included the property that gets the UserManager.
Why would this be null? Is this something to do with the UmbracoIdentity package or is it due to upgrades to 7.3 that break identity? I have read some rumblings about changes in 7.3 that could cause this but nothing specific enough for me to be sure.
Any suggested fixes either way would be amazing!
[HttpPost]
[AllowAnonymous]
public async Task<ActionResult> HandleLogin([Bind(Prefix = "loginModel")] LoginModel model)
{
if (ModelState.IsValid)
{
// UserManager is null here - WHY!?
var user = await UserManager.FindAsync(model.Username, model.Password);
if (user != null)
{
await SignInAsync(user, true);
return RedirectToCurrentUmbracoPage();
}
ModelState.AddModelError("loginModel", "Invalid username or password");
}
return CurrentUmbracoPage();
}
public UmbracoMembersUserManager<UmbracoApplicationMember> UserManager
{
get
{
return _userManager ?? (_userManager = OwinContext
.GetUserManager<UmbracoMembersUserManager<UmbracoApplicationMember>>());
}
}
Which will install some additional startup classes that you can use. See the UmbracoStandardOwinStartup class once you install that. Then use it in your appSettings. Then you need to enable the Umbraco Identity stuff on your own inside of this class:
7.3 Identity Issues
I have a member login built using UmbracoIdentity. (https://github.com/Shazwazza/UmbracoIdentity)
The UserManager in the below code is returned as null. I have included the property that gets the UserManager.
Why would this be null? Is this something to do with the UmbracoIdentity package or is it due to upgrades to 7.3 that break identity? I have read some rumblings about changes in 7.3 that could cause this but nothing specific enough for me to be sure.
Any suggested fixes either way would be amazing!
My UmbracoIdentityStartup was not being executed.
I had this line in my web.config:
Commenting this out fixes the issue.
I had not added this line so assumed it was something to do with the package, however examining the package further suggested otherwise.
J
This fix breaks login to the back end.
It appears this package is incompatible with the back end login, which makes me wonder how you're supposed to use it at all? =/
So what do I do now? There must be some way to do this. Grr!
Hi, you cannot just ignore the umbraco OWIN startup. There can only be a single OWIN startup, so you need to combine all features.
There's another package that might help:
https://www.nuget.org/packages/UmbracoCms.IdentityExtensions
Which will install some additional startup classes that you can use. See the UmbracoStandardOwinStartup class once you install that. Then use it in your appSettings. Then you need to enable the Umbraco Identity stuff on your own inside of this class:
https://github.com/Shazwazza/UmbracoIdentity/wiki/Startup-Configuration
I've updated the docs a bit here: https://github.com/Shazwazza/UmbracoIdentity/blob/master/README.md
I will make a new major version of this for Umbraco 7.3.2 once it is out and remove support for this project for Umbraco < 7.3.2.
That's great Shannon, thanks.
I needed to add this line to UmbracoStandardOwinStartup to get both back end and front end playing happily together.
Thanks very much for your efforts!
is working on a reply...