Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Arthur 10 posts 80 karma points
    Sep 10, 2018 @ 12:49
    Arthur
    0

    Umbraco 7 User Login(backoffice) Programmatically

    public override Task<bool> CheckPasswordAsync(BackOfficeIdentityUser user, string password)
        {
            var userService = ApplicationContext.Current.Services.UserService;
    
            try
            {
    
                var userStatus = (userService.GetByEmail(user.Email.ToString()) != null) ? true : false;
    
                var userLogin =  UmbracoContext.Current.Security.PerformLogin(user.Id);
    
                var user = ApplicationContext.Services.UserService.GetUserById(id);
    
                return Task.FromResult(userStatus);
    
            }
    
            catch (Exception)
            {
    
                //throw;
            }
            return Task.FromResult(false);
    
        }
    

    I am having same issue. userStatus shows true since user exists in database however, performlogin does not happen and return user=null when i check umbTicket status.

                      if (UmbracoContext.Security.ValidateBackOfficeCredentials(loginModel.Username, loginModel.Password))
                    {
    
                        var httpCtxWrapper = new System.Web.HttpContextWrapper(System.Web.HttpContext.Current);
                        var umbTicket = httpCtxWrapper.GetUmbracoAuthTicket();
    
                        var loginUser = userService.GetByUsername(umbTicket.Name); 
    
                    }
    

    any idea. thanks

  • Alex Skrypnyk 6182 posts 24284 karma points MVP 9x admin c-trib
    Nov 12, 2018 @ 18:21
    Alex Skrypnyk
    0

    Hi Arthur

    Which version of Umbraco are you using? Did you post an issue you Umbraco issue tracker?

    Thanks,

    Alex

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies