Exemplo n.º 1
0
        protected override string AuthenticateToken(UsernameToken token)
        {
            LoginUserStatus invalidCredentials;

            try
            {
                SiteManager user = Users.GetUser(0, token.Identity.Name, false, false) as SiteManager;
                if ((user != null) && user.IsAdministrator)
                {
                    HiContext current = HiContext.Current;
                    user.Password      = HiCryptographer.Decrypt(token.Password);
                    invalidCredentials = Users.ValidateUser(user);
                }
                else
                {
                    invalidCredentials = LoginUserStatus.InvalidCredentials;
                }
            }
            catch
            {
                invalidCredentials = LoginUserStatus.InvalidCredentials;
            }
            if (invalidCredentials == LoginUserStatus.Success)
            {
                return(token.Password);
            }
            return(HiCryptographer.CreateHash(token.Password));
        }
Exemplo n.º 2
0
 protected override string AuthenticateToken(UsernameToken token)
 {
     Hidistro.Membership.Core.Enums.LoginUserStatus loginUserStatus;
     try
     {
         Hidistro.Membership.Context.SiteManager siteManager = Hidistro.Membership.Context.Users.GetUser(0, token.Identity.Name, false, false) as Hidistro.Membership.Context.SiteManager;
         if (siteManager != null && siteManager.IsAdministrator)
         {
             Hidistro.Membership.Context.HiContext arg_29_0 = Hidistro.Membership.Context.HiContext.Current;
             siteManager.Password = HiCryptographer.Decrypt(token.Password);
             loginUserStatus      = Hidistro.Membership.Context.Users.ValidateUser(siteManager);
         }
         else
         {
             loginUserStatus = Hidistro.Membership.Core.Enums.LoginUserStatus.InvalidCredentials;
         }
     }
     catch
     {
         loginUserStatus = Hidistro.Membership.Core.Enums.LoginUserStatus.InvalidCredentials;
     }
     if (loginUserStatus == Hidistro.Membership.Core.Enums.LoginUserStatus.Success)
     {
         return(token.Password);
     }
     return(HiCryptographer.CreateHash(token.Password));
 }