Auth a user (ValidateCredentialsAsync &PasswordSig...
# help-with-umbraco
z
Hello, I am trying to do lean out my controllers by moving logic into relevant services in a "core project". As far as I understand, the Core project shouldn't reference
Umbraco.Cms.Web
For example, I want to move this into a service:
Copy code
var loginResult = await _memberSignInManager.PasswordSignInAsync(model.Username, model.Password, true, false);
How should I be going about this, or is it something that should stay on the controller?
h
install the Umbraco.Cms.Web.Common nuget package and then inject IMemberSignInManager in your service
z
I was under the impression that package should only be in the web.ui project? or does it not really matter?
h
Umbraco.Cms is the package that goes in the web.ui project
z
ah, okay
duh!
is this the correct way of going about what I am trying to do, or does it not really matter?
h
I would normally use a controller rather than a service to deal with logins etc because you are generally posting a form to a controller action (controller is in a separate package to the UI
z
ah, that was the next step actually, shifting the controllers out of the ui project
h
That is just a matter of moving them 🙂 to the other project
13 Views