示例#1
0
 public int TestPassword(string password)
 {
     byte[]    bytes       = new UnicodeEncoding().GetBytes(password);
     byte[]    encPassword = new SHA1CryptoServiceProvider().ComputeHash(bytes);
     Data.User user        = new Data.User(PubConstant.ConnectionString);
     return(user.TestPassword(this.userID, encPassword));
 }
示例#2
0
        /// <summary>
        /// 检查当前用户对象密码
        /// </summary>
        public int TestPassword(string password)
        {
            // At some point, we may have a more complex way of encrypting or storing the passwords
            // so by supplying this procedure, we can simply replace its contents to move password
            // comparison to the database (as we've done below) or somewhere else (e.g. another
            // web service, etc).
            UnicodeEncoding encoding = new UnicodeEncoding();

            byte[] hashBytes = encoding.GetBytes(password);
            SHA1   sha1      = new SHA1CryptoServiceProvider();

            byte[] cryptPassword = sha1.ComputeHash(hashBytes);
            return(dataUser.TestPassword(userID, cryptPassword));
        }
        public int TestPassword(string password)
        {
            moduleSettings = ModuleConfig.GetSettings();
            UnicodeEncoding encoding = new UnicodeEncoding();
            byte[] hashBytes = encoding.GetBytes(password);
            SHA1 sha1 = new SHA1CryptoServiceProvider();
            byte[] cryptPassword = sha1.ComputeHash(hashBytes);

            Data.User user = new Data.User (moduleSettings);
            return user.TestPassword(ID, cryptPassword);
        }