Пример #1
0
        // проверка кэша паролей
        public bool CheckPassCache(string login, string password)
        {
            string msg = null;

            STUser dbuser;
            CUser  clUser = new CUser(LocalData.UserId(), LocalData.CSDbUsers(), LocalData.LogPath());
            // находим юзера в БД по логину
            int retvalue = clUser.GetRecordByUserLogin(login, out dbuser, out msg);

            // находим кэш паролей в БД по логину юзера
            List <STPassCache> lstpc = new List <STPassCache>();

            retvalue = clUser.GetPassCache(login, out lstpc, out msg);

            if (lstpc.Count <= 0)
            {
                return(false);
            }

            // сравниваем введенный пароль со спсиком паролей
            foreach (STPassCache pc in lstpc)
            {
                string PASS = CreatePasswordHash(password, pc.passwordsalt);
                if (pc.password == PASS)
                {
                    return(true);
                }
            }

            return(false);
        }