Esempio n. 1
0
        /// <summary>
        /// 登录密码登录
        /// </summary>
        /// <param name="username"></param>
        /// <param name="password"></param>
        /// <returns></returns>
        public UserEntity Login(string username, string password)
        {
            UserEntity userEntity = service.FindEntity(t => t.F_Account == username);

            if (userEntity == null)
            {
                throw new Exception("账户不存在,请重新输入");
            }

            if (userEntity.F_EnabledMark != true)
            {
                throw new Exception("账户被系统锁定,请联系管理员");
            }

            UserLogOnEntity userLogOnEntity = userLogOnApp.GetForm(userEntity.F_Id);
            string          dbPassword      = Md5Encrypt.Md5(AES.Encrypt(password.ToLower(), userLogOnEntity.F_UserSecretkey).ToLower(), 32).ToLower();

            if (dbPassword != userLogOnEntity.F_UserPassword)
            {
                throw new Exception("密码不正确,请重新输入");
            }

            DateTime lastVisitTime = DateTime.Now;
            int      LogOnCount    = userLogOnEntity.F_LogOnCount ?? +1;

            if (userLogOnEntity.F_LastVisitTime != null)
            {
                userLogOnEntity.F_PreviousVisitTime = userLogOnEntity.F_LastVisitTime;
            }
            userLogOnEntity.F_LastVisitTime = lastVisitTime;
            userLogOnEntity.F_LogOnCount    = LogOnCount;
            userLogOnApp.UpdateForm(userLogOnEntity);
            return(userEntity);
        }
Esempio n. 2
0
        public async Task <UserEntity> Login(string username, string password)
        {
            return(await Task.Run(() =>
            {
                UserEntity userEntity = userService.FindEntity(t => t.Account == username);
                if (userEntity == null)
                {
                    throw new Exception("账户不存在,请重新输入");
                }
                if (userEntity.EnabledMark != true)
                {
                    throw new Exception("账户被系统锁定,请联系管理员");
                }

                UserLogOnEntity userLogOnEntity = userLogService.FindEntity(o => o.UserId == userEntity.Id);
                string dbPassword = Md5Encrypt.Md5(AES.Encrypt(password.ToLower(), userLogOnEntity.UserSecretkey).ToLower(), 32).ToLower();
                if (dbPassword != userLogOnEntity.UserPassword)
                {
                    throw new Exception("密码不正确,请重新输入");
                }

                DateTime lastVisitTime = DateTime.Now;
                int LogOnCount = userLogOnEntity.LogOnCount ?? +1;
                if (userLogOnEntity.LastVisitTime != null)
                {
                    userLogOnEntity.PreviousVisitTime = userLogOnEntity.LastVisitTime;
                }
                userLogOnEntity.LastVisitTime = lastVisitTime;
                userLogOnEntity.LogOnCount = LogOnCount;
                userLogService.Update(userLogOnEntity);
                return userEntity;
            }));
        }
Esempio n. 3
0
        public void RevisePassword(string userPassword, string keyValue)
        {
            UserLogOnEntity userLogOnEntity = new UserLogOnEntity();

            userLogOnEntity.F_Id            = keyValue;
            userLogOnEntity.F_UserSecretkey = Md5Encrypt.Md5(Common.CreateNo(), 16).ToLower();
            userLogOnEntity.F_UserPassword  = Md5Encrypt.Md5(AES.Encrypt(Md5Encrypt.Md5(userPassword, 32).ToLower(), userLogOnEntity.F_UserSecretkey).ToLower(), 32).ToLower();
            service.Update(userLogOnEntity);
        }
Esempio n. 4
0
        public List <HPITMemberInfo> LoginMember(string loginName, string passWord)
        {
            string         sql = @"select * from(  select m.RealName,m.Mobile,m.Email,r.Category,r.FullName,r.Description,r.OrganizeId 
                          ,o.FullName as oFullName,o.Address,o.Manager,o.Mobile as oMobile,ma.Password
                          from Member m 
                          left join RoleInfo r on m.RoleId = r.Id
                          left join Organize o on m.OrganizeId = o.Id
                          left join MemberAccount ma on ma.Id = m.MemberAccountId) t where t.RealName = @RealName and t.Password = @Password";
            HPITMemberInfo stu = new HPITMemberInfo();

            stu.RealName = loginName;
            stu.Password = Md5Encrypt.Md5(passWord);
            LogHelper.Default.WriteInfo(stu.RealName + "---" + stu.Password);
            List <HPITMemberInfo> result = DapperDBHelper.Instance.ExcuteQuery <HPITMemberInfo>(sql, stu).ToList();

            return(result);
        }
Esempio n. 5
0
 public void SubmitForm(UserEntity userEntity, UserLogOnEntity userLogOnEntity, string keyValue)
 {
     using (var db = new RepositoryBase().BeginTrans())
     {
         if (!string.IsNullOrEmpty(keyValue))
         {
             db.Update(userEntity);
         }
         else
         {
             userLogOnEntity.F_Id            = userEntity.F_Id;
             userLogOnEntity.F_UserId        = userEntity.F_Id;
             userLogOnEntity.F_UserSecretkey = Md5Encrypt.Md5(Common.CreateNo(), 16).ToLower();
             userLogOnEntity.F_UserPassword  = Md5Encrypt.Md5(AES.Encrypt(Md5Encrypt.Md5(userLogOnEntity.F_UserPassword, 32).ToLower(), userLogOnEntity.F_UserSecretkey).ToLower(), 32).ToLower();
             db.Insert(userEntity);
             db.Insert(userLogOnEntity);
         }
         db.Commit();
     }
 }
Esempio n. 6
0
 public void TestMethodLogin()
 {
     EvaluteDal dal   = new EvaluteDal();
     string     encry = Md5Encrypt.Md5("123456");
     var        json  = dal.LoginMember("诸葛亮", encry);
 }