Member service no longer has "Members.Login(user, ...
# help-with-umbraco
b
Hey, we're using the member service to log in and handle members and at some point we grab those users and create them in our own system (not important here). I've started making my changes and here are is a snuppet of my code that I've started getting to work:
Copy code
[HttpGet]
        public IActionResult Login(LoginModel model)
        {
            var members = _memberService.GetAllMembers();
            if (!ModelState.IsValid)
            {
                return CurrentUmbracoPage();
            }
            if (members.Login(model.Username, model.Password))
            {
                return Redirect("/landing-page");
            }
            else
            {
                ViewBag.BadLogin = true;

                ModelState.AddModelError("", "Invalid Login Credentials");
            }

            return CurrentUmbracoPage();
        }
Members.Login is the only part of the method not currently working. Is it a massive job to get sorted?
h
I do this _memberSignInManager.PasswordSignInAsync(login.Username, login.Password, login.RememberMe, true);
sorry posted wrong code first time 😄
b
AMAZING, thank you so much. slots right in 😄
Can I be cheeky and ask how you do logout in 10 aswell? 🤣
h
_memberSignInManager.SignOutAsync();
b
I feel very stupid because I couldn't see that on the method list thank you so much!
h
no prob 😄
b
I do have a follow up Q if that's okay! We also use the members.SavePasseord functionality which has been deprecated since 7. Any idea on our best alternative?
h
do you want to reset password (where user doesn't know current password? or change password (user knows current password)
b
sorry to take so long to reply! Very busy weekend 🤣 In our case it would be a change password, as we are doing a userimport!
h
var member = _memberManager.GetCurrentMemberAsync().Result; var changePasswordResult = await _memberManager.ChangePasswordAsync(member, model.OldPassword, model.NewPassword);
5 Views