/// <summary> /// 更新用户密码 /// </summary> /// <param name="entity">用户信息</param> /// <param name="oldPassword">旧密码</param> public void UpdateUserPasswordBySysNo(Users entity, string oldPassword) { //check if (string.IsNullOrWhiteSpace(oldPassword)) { throw new BusinessException("必须输入旧密码!"); } if (string.IsNullOrWhiteSpace(entity.Password)) { throw new BusinessException("必须输入新密码!"); } var user = UsersMgtDA.GetValidUserByUserID(entity.UserID); string currOldPassword = MD5Encrypt.MD5Encrypt32(string.Format("{0}-{1}", oldPassword, user.UserAuthCode)).ToLower(); if (!currOldPassword.Equals(user.Password)) { throw new BusinessException("旧密码错误!"); } entity.Password = MD5Encrypt.MD5Encrypt32(string.Format("{0}-{1}", entity.Password, user.UserAuthCode)).ToLower(); UsersMgtDA.UpdateUserPasswordByUserID(entity); }
/// <summary> /// 根据用户ID获取有效用户 /// </summary> /// <param name="userID">用户ID</param> /// <returns></returns> public Users GetValidUserByUserID(string userID) { return(UsersMgtDA.GetValidUserByUserID(userID)); }