Esempio n. 1
0
        public static bool UpdatePsw(string userId, string psw, string newPsw, string confirmNewPsw)
        {
            bool flag = string.IsNullOrEmpty(userId);

            if (flag)
            {
                throw new Exception("用户名或密码错误!");
            }
            bool flag2 = newPsw != confirmNewPsw;

            if (flag2)
            {
                throw new Exception("两次输入的密码不匹配!");
            }
            User user  = UserUtils.GetUser(userId);
            bool flag3 = user == null;

            if (flag3)
            {
                throw new Exception("用户名或密码错误!");
            }
            bool disabled = user.Disabled;

            if (disabled)
            {
                throw new Exception("当前用户名已被停用!");
            }
            SystemInfo systemInfo = SystemInfoUtils.GetSystemInfo();
            bool       flag4      = systemInfo != null && systemInfo.PswLength > 0 && systemInfo.PswLength > newPsw.Length;

            if (flag4)
            {
                throw new Exception(string.Format("密码长度小于系统指定最短长度({0})!", systemInfo.PswLength));
            }
            bool flag5 = user.Password != PasswordSec.Encode(userId, psw);

            if (flag5)
            {
                throw new Exception("用户名或密码错误!");
            }
            Database database = LogicContext.GetDatabase();
            HSQL     sql      = new HSQL(database);

            sql.Clear();
            sql.Add("UPDATE USERS SET");
            sql.Add("USERS_PASSWORD = :USERS_PASSWORD");
            sql.Add("WHERE USERS_USERID = :USERS_USERID");
            sql.ParamByName("USERS_PASSWORD").Value = PasswordSec.Encode(userId, newPsw);
            sql.ParamByName("USERS_USERID").Value   = userId;
            bool flag6 = database.ExecSQL(sql) != 1;

            if (flag6)
            {
                throw new Exception(string.Format("用户({0})密码修改失败!", userId));
            }
            CacheEvent.TableIsUpdated("USERS");
            return(true);
        }
Esempio n. 2
0
        public static SystemInfo GetSystemInfo(string systemId)
        {
            SystemInfo      systemInfo      = null;
            SystemInfoCache systemInfoCache = (SystemInfoCache) new SystemInfoCache().GetData();
            int             index           = systemInfoCache.dvSystemBy_Id.Find(systemId);
            bool            flag            = index >= 0;

            if (flag)
            {
                SystemInfo systemInfo2 = new SystemInfo();
                systemInfo = SystemInfoUtils.GetObject(systemInfoCache.dvSystemBy_Id[index].Row);
            }
            return(systemInfo);
        }
Esempio n. 3
0
 public static SystemInfo GetSystemInfo()
 {
     return(SystemInfoUtils.GetSystemInfo("0000000001"));
 }