升级到.net core 3.1;整体组件升级到最新版本
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netcoreapp3.0</TargetFramework>
|
||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -1,22 +1,20 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netcoreapp3.0</TargetFramework>
|
||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<FrameworkReference Include="Microsoft.AspNetCore.App" />
|
||||
<PackageReference Include="NewLife.Core" Version="8.3.2019.923" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="12.0.2" />
|
||||
<PackageReference Include="NewLife.Core" Version="8.4.2019.1203" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
|
||||
<PackageReference Include="PinYinConverterCore" Version="1.0.2" />
|
||||
<PackageReference Include="System.Configuration.ConfigurationManager" Version="4.6.0" />
|
||||
<PackageReference Include="System.Configuration.ConfigurationManager" Version="4.7.0" />
|
||||
<PackageReference Include="ZKWeb.System.Drawing" Version="4.0.1" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Reference Include="Microsoft.AspNetCore.Authentication.Cookies">
|
||||
<HintPath>C:\Program Files\dotnet\sdk\NuGetFallbackFolder\microsoft.aspnetcore.authentication.cookies\2.1.1\lib\netstandard2.0\Microsoft.AspNetCore.Authentication.Cookies.dll</HintPath>
|
||||
</Reference>
|
||||
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netcoreapp3.0</TargetFramework>
|
||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="NewLife.XCode" Version="9.14.2019.923" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="12.0.2" />
|
||||
<PackageReference Include="NewLife.XCode" Version="9.14.2019.1203" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
@@ -14,9 +14,6 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Reference Include="Microsoft.AspNetCore.Authentication.Cookies">
|
||||
<HintPath>C:\Program Files\dotnet\sdk\NuGetFallbackFolder\microsoft.aspnetcore.authentication.cookies\2.1.1\lib\netstandard2.0\Microsoft.AspNetCore.Authentication.Cookies.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
@@ -483,8 +483,6 @@ namespace COMCMS.Web.Areas.AdminCP.Controllers
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//处理三个勾选属性的
|
||||
string isnew = Request.Form["IsNew"];
|
||||
model.IsNew = isnew == "1" ? 1 : 0;
|
||||
|
||||
@@ -493,6 +491,8 @@ namespace COMCMS.Web.Areas.AdminCP.Controllers
|
||||
|
||||
string IsHide = Request.Form["IsHide"];
|
||||
model.IsHide = IsHide == "1" ? 1 : 0;
|
||||
//处理三个勾选属性的
|
||||
|
||||
model.Hits = entity.Hits;
|
||||
model.UpdateTime = DateTime.Now;
|
||||
|
||||
@@ -503,8 +503,43 @@ namespace COMCMS.Web.Areas.AdminCP.Controllers
|
||||
content = ThumbnailHelper.SaveRemoteImgForContent(content);
|
||||
model.Content = content;
|
||||
}
|
||||
|
||||
|
||||
entity.AddTime = model.AddTime;
|
||||
entity.AdsId = model.AdsId;
|
||||
entity.BannerImg = model.BannerImg;
|
||||
entity.Content = model.Content;
|
||||
entity.Description = model.Description;
|
||||
entity.FilePath = model.FilePath;
|
||||
entity.Hits = model.Hits;
|
||||
entity.Icon = model.Icon;
|
||||
entity.IsBest = model.IsBest;
|
||||
entity.IsComment = model.IsComment;
|
||||
entity.IsDel = model.IsDel;
|
||||
entity.IsHide = model.IsHide;
|
||||
entity.IsLock = model.IsLock;
|
||||
entity.IsMember = model.IsMember;
|
||||
entity.IsNew = model.IsNew;
|
||||
entity.IsRecommend = model.IsRecommend;
|
||||
entity.IsTop = model.IsTop;
|
||||
entity.ItemImg = morIMG;
|
||||
entity.Keyword = model.Keyword;
|
||||
entity.KId = model.KId;
|
||||
entity.LinkURL = model.LinkURL;
|
||||
entity.Location = model.Location;
|
||||
entity.Origin = model.Origin;
|
||||
entity.OriginURL = model.OriginURL;
|
||||
entity.Pic = model.Pic;
|
||||
entity.Sequence = model.Sequence;
|
||||
entity.SubTitle = model.SubTitle;
|
||||
entity.Tags = model.Tags;
|
||||
entity.TemplateFile = model.TemplateFile;
|
||||
entity.Title = model.Title;
|
||||
entity.TitleColor = model.TitleColor;
|
||||
entity.UpdateTime = DateTime.Now;
|
||||
|
||||
//model.AuthorId = Core.Admin.GetMyInfo().Id;
|
||||
model.Save();
|
||||
entity.Update();
|
||||
//Tag.ModifyTags(model.Tags, RTType.RatuoModule.Article, model.Id, model.Title);
|
||||
Core.Admin.WriteLogActions("编辑文章(id:" + model.Id + ");");
|
||||
tip.Status = JsonTip.SUCCESS;
|
||||
|
||||
@@ -10,6 +10,11 @@ using XCode;
|
||||
using Newtonsoft.Json;
|
||||
using COMCMS.Web.Common;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using System.IO;
|
||||
using NewLife.Log;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.Extensions.FileProviders;
|
||||
using System.Text;
|
||||
|
||||
namespace COMCMS.Web.Areas.AdminCP.Controllers
|
||||
{
|
||||
@@ -17,6 +22,12 @@ namespace COMCMS.Web.Areas.AdminCP.Controllers
|
||||
[DisplayName("后台权限")]
|
||||
public class PermissionController : AdminBaseController
|
||||
{
|
||||
private IWebHostEnvironment _env;
|
||||
public PermissionController(IWebHostEnvironment env)
|
||||
{
|
||||
_env = env;
|
||||
}
|
||||
|
||||
#region 事件管理
|
||||
/// <summary>
|
||||
/// 目标事件
|
||||
@@ -329,5 +340,77 @@ namespace COMCMS.Web.Areas.AdminCP.Controllers
|
||||
return Json(tip);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 系统运行日志
|
||||
[HttpGet]
|
||||
[MyAuthorize("viewlist", "runlogs")]
|
||||
[DisplayName("系统运行日志")]
|
||||
public IActionResult RunLogs()
|
||||
{
|
||||
string logPath = $"{_env.ContentRootPath}{Path.DirectorySeparatorChar}Log{Path.DirectorySeparatorChar}";
|
||||
List<string> lognames = new List<string>();
|
||||
try
|
||||
{
|
||||
if (Directory.Exists(logPath))
|
||||
{
|
||||
DirectoryInfo directory = new DirectoryInfo(logPath);
|
||||
List<string> listFiles = new List<string>();
|
||||
DirectoryInfo[] directorys = directory.GetDirectories();
|
||||
FileInfo[] files;
|
||||
files = directory.GetFiles();
|
||||
foreach (FileInfo file in files)
|
||||
{
|
||||
lognames.Add(file.Name);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
XTrace.WriteException(ex);
|
||||
}
|
||||
lognames.Reverse();//倒序排列一下
|
||||
ViewBag.logPath = logPath;
|
||||
return View(lognames);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 获取日志详情
|
||||
[HttpPost]
|
||||
[MyAuthorize("viewlist", "runlogs")]
|
||||
public async Task<IActionResult> GetRunLogDetail(string logname)
|
||||
{
|
||||
if (string.IsNullOrEmpty(logname))
|
||||
{
|
||||
return Content("错误日志名称!");
|
||||
}
|
||||
string logPath = $"{_env.ContentRootPath}{Path.DirectorySeparatorChar}Log{Path.DirectorySeparatorChar}";
|
||||
string logFullPath = logPath + logname;
|
||||
|
||||
|
||||
if (!System.IO.File.Exists(logFullPath))
|
||||
{
|
||||
return Content("系统找不到本日志文件!");
|
||||
}
|
||||
XTrace.WriteLine("查看日志:" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
|
||||
|
||||
IFileProvider fileProvider = new PhysicalFileProvider(logPath);
|
||||
StringBuilder detail = new StringBuilder();
|
||||
using (Stream stream = fileProvider.GetFileInfo(logname).CreateReadStream())
|
||||
{
|
||||
byte[] buffer = new byte[stream.Length];
|
||||
await stream.ReadAsync(buffer, 0, buffer.Length);
|
||||
detail.Append(Encoding.Default.GetString(buffer));
|
||||
}
|
||||
|
||||
|
||||
//using (StreamReader fs = new StreamReader(logFullPath))
|
||||
//{
|
||||
// detail.Append(fs.ReadToEndAsync());
|
||||
//}
|
||||
|
||||
//string detail = await System.IO.File.ReadAllTextAsync(logFullPath);
|
||||
return Content(detail.ToString());
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -25,7 +25,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">文章标题:</label>
|
||||
<label class="col-sm-3 control-label text-danger">文章标题:</label>
|
||||
<div class="col-sm-8">
|
||||
<input id="Title" name="Title" maxlength="200" type="text" class="form-control" required aria-required="true" placeholder="填写文章标题">
|
||||
</div>
|
||||
|
||||
@@ -221,7 +221,7 @@
|
||||
return false;
|
||||
}
|
||||
list.map(function (item, index) {
|
||||
if (item.Id) {
|
||||
if (item.id) {
|
||||
ids.push(item.id);
|
||||
}
|
||||
})
|
||||
@@ -265,7 +265,7 @@
|
||||
return false;
|
||||
}
|
||||
list.map(function (item, index) {
|
||||
if (item.Id) {
|
||||
if (item.id) {
|
||||
ids.push(item.id);
|
||||
}
|
||||
})
|
||||
|
||||
@@ -1,22 +1,22 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netcoreapp3.0</TargetFramework>
|
||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="MailKit" Version="2.3.2" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="3.0.0" />
|
||||
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="3.0.0" />
|
||||
<PackageReference Include="MimeKit" Version="2.3.2" />
|
||||
<PackageReference Include="MailKit" Version="2.4.1" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="3.1.0" />
|
||||
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="3.1.0" />
|
||||
<PackageReference Include="MimeKit" Version="2.4.1" />
|
||||
<PackageReference Include="MySql.Data" Version="8.0.18" />
|
||||
<PackageReference Include="NewLife.XCode" Version="9.14.2019.923" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="12.0.2" />
|
||||
<PackageReference Include="Senparc.Weixin" Version="6.6.102" />
|
||||
<PackageReference Include="Senparc.Weixin.MP" Version="16.9.102" />
|
||||
<PackageReference Include="Senparc.Weixin.TenPay" Version="1.5.102" />
|
||||
<PackageReference Include="Senparc.Weixin.WxOpen" Version="3.7.102" />
|
||||
<PackageReference Include="System.Data.SqlClient" Version="4.7.0" />
|
||||
<PackageReference Include="NewLife.XCode" Version="9.14.2019.1203" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
|
||||
<PackageReference Include="Senparc.Weixin" Version="6.6.104" />
|
||||
<PackageReference Include="Senparc.Weixin.MP" Version="16.9.104" />
|
||||
<PackageReference Include="Senparc.Weixin.TenPay" Version="1.5.104" />
|
||||
<PackageReference Include="Senparc.Weixin.WxOpen" Version="3.7.104" />
|
||||
<PackageReference Include="System.Data.SqlClient" Version="4.8.0" />
|
||||
<PackageReference Include="ZKWeb.System.Drawing" Version="4.0.1" />
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
+14
-11
@@ -77,7 +77,10 @@ namespace COMCMS.Web
|
||||
//记录错误
|
||||
options.Filters.Add<HttpGlobalExceptionFilter>();
|
||||
})
|
||||
.AddNewtonsoftJson(options =>options.SerializerSettings.ContractResolver = new CamelCasePropertyNamesContractResolver());
|
||||
.AddNewtonsoftJson(options => {
|
||||
options.SerializerSettings.ContractResolver = new CamelCasePropertyNamesContractResolver();
|
||||
options.SerializerSettings.DateFormatString = "yyyy-MM-dd HH:mm:ss";
|
||||
});
|
||||
|
||||
//防止汉字被自动编码
|
||||
services.Configure<WebEncoderOptions>(options =>
|
||||
@@ -92,16 +95,16 @@ namespace COMCMS.Web
|
||||
services.AddAuthentication(CookieAuthenticationDefaults.AuthenticationScheme).AddCookie();
|
||||
|
||||
// 设置表单内容限制
|
||||
//services.Configure<FormOptions>(options =>
|
||||
//{
|
||||
// //formOptions.ValueLengthLimit = int.MaxValue; // 表单内容大小限制,默认4194304,单位byte
|
||||
// //formOptions.MultipartBodyLengthLimit = int.MaxValue; // 如果是multipart,默认134217728
|
||||
// options.ValueCountLimit = int.MaxValue;
|
||||
// options.ValueLengthLimit = int.MaxValue;
|
||||
// options.KeyLengthLimit = int.MaxValue;
|
||||
// options.MultipartBodyLengthLimit = int.MaxValue;
|
||||
// options.MultipartBoundaryLengthLimit = int.MaxValue;
|
||||
//});
|
||||
services.Configure<FormOptions>(options =>
|
||||
{
|
||||
//formOptions.ValueLengthLimit = int.MaxValue; // 表单内容大小限制,默认4194304,单位byte
|
||||
//formOptions.MultipartBodyLengthLimit = int.MaxValue; // 如果是multipart,默认134217728
|
||||
options.ValueCountLimit = int.MaxValue;
|
||||
options.ValueLengthLimit = int.MaxValue;
|
||||
options.KeyLengthLimit = int.MaxValue;
|
||||
options.MultipartBodyLengthLimit = int.MaxValue;
|
||||
options.MultipartBoundaryLengthLimit = int.MaxValue;
|
||||
});
|
||||
}
|
||||
|
||||
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
|
||||
|
||||
@@ -211,7 +211,7 @@
|
||||
</div>
|
||||
<div class="foot-bottom">
|
||||
<div class="cont">
|
||||
<span>@ViewBag.cfg.Copyright <a href="http://www.comcms.com/" target="_blank"> 技术支持:COMCMS</a> <a href="http://www.miitbeian.gov.cn/" target="_blank">粤ICP备8888888号-1</a></span>
|
||||
<span>@ViewBag.cfg.Copyright <a href="http://www.comcms.com/" target="_blank"> 技术支持:COMCMS</a> <a href="http://www.miitbeian.gov.cn/" target="_blank">粤ICP备8888888号-1</a> Powered by .NET Core 3.1.0 on Windows Server</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netstandard2.0</TargetFramework>
|
||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.AspNetCore" Version="2.2.0" />
|
||||
<FrameworkReference Include="Microsoft.AspNetCore.App" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netstandard2.0</TargetFramework>
|
||||
<TargetFramework>netstandard2.1</TargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.AspNetCore.Http.Features" Version="2.2.0" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Http.Features" Version="3.1.0" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
@@ -4,10 +4,10 @@ COMCMS NETCORE版本,一个简单的CMS后台管理系统,暂时不带前台
|
||||
|
||||
### 技术简要
|
||||
|
||||
- .net core 3.0 (请注意升级本地SDK 或者runtime)
|
||||
- .net core 3.1 (请注意升级本地SDK 或者runtime)
|
||||
- 数据库:Mysql 5.7 /Mysql 8.0
|
||||
- ORM:数据库操作使用XCode,目前支持mysql、sqlserver。详细见:https://github.com/NewLifeX/X
|
||||
- 据库驱动使用:MySQL官方驱动,8.0.19
|
||||
- 据库驱动使用:MySQL官方驱动,8.0.18
|
||||
- 后台模板是H+
|
||||
- 编辑器采用CKeditor 支持截图粘贴进去,上传图片采用webuploader
|
||||
|
||||
@@ -19,7 +19,7 @@ COMCMS NETCORE版本,一个简单的CMS后台管理系统,暂时不带前台
|
||||
|
||||
- COMCMS.Core 数据库操作核心业务逻辑和实体 采用XCode
|
||||
|
||||
- COMCMS.Web .net core 2.1 的MVC网站。
|
||||
- COMCMS.Web .net core 3.1 的MVC网站。
|
||||
|
||||
- XCoder 代码生成器,跟上述的没任何关系,只是为了生成数据库操作业务逻辑和实体而已。
|
||||
|
||||
@@ -35,7 +35,7 @@ COMCMS NETCORE版本,一个简单的CMS后台管理系统,暂时不带前台
|
||||
|
||||
```
|
||||
演示地址(windows server 2019 + IIS):前台:[前台演示地址](http://123.207.59.192) 后台:[后台演示地址](http://123.207.59.192/AdminCP)
|
||||
演示地址2(Centos + Nginx):后台[http://47.106.32.133/AdminCP]
|
||||
|
||||
|
||||
账号密码都是admin
|
||||
|
||||
|
||||
@@ -8,8 +8,8 @@
|
||||
<#
|
||||
// 设置当前工作目录
|
||||
PathHelper.BaseDirectory = Host.ResolvePath(".");
|
||||
// 导入模型文件并生成实体类,模型文件、输出目录、命名空间、连接名、中文文件名
|
||||
//EntityBuilder.Build(String xmlFile = null, String output = null, String nameSpace = null, String connName = null, Boolean? chineseFileName = true);
|
||||
// 导入模型文件并生成实体类,模型文件、输出目录、命名空间、连接名、中文文件名、表名字段名大小写
|
||||
//EntityBuilder.Build(String xmlFile = null, String output = null, String nameSpace = null, String connName = null, Boolean? chineseFileName = true,Boolean? nameIgnoreCase = null);
|
||||
EntityBuilder.Build();
|
||||
|
||||
//var tables = DAL.ImportFrom("Company.Project.xml");
|
||||
|
||||
@@ -30,12 +30,14 @@
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="NewLife.Core, Version=8.3.7207.798, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\NewLife.Core.8.3.2019.923\lib\net46\NewLife.Core.dll</HintPath>
|
||||
<Reference Include="Microsoft.VisualBasic" />
|
||||
<Reference Include="NewLife.Core, Version=8.4.7276.41220, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\NewLife.Core.8.4.2019.1203\lib\net46\NewLife.Core.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.IO.Compression" />
|
||||
<Reference Include="System.Management" />
|
||||
<Reference Include="System.ServiceProcess" />
|
||||
<Reference Include="System.Web" />
|
||||
<Reference Include="System.Web.Extensions" />
|
||||
@@ -46,8 +48,8 @@
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Net.Http" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="XCode, Version=9.14.7207.834, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\NewLife.XCode.9.14.2019.923\lib\net46\XCode.dll</HintPath>
|
||||
<Reference Include="XCode, Version=9.14.7276.41290, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\NewLife.XCode.9.14.2019.1203\lib\net45\XCode.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="NewLife.Core" version="8.3.2019.923" targetFramework="net461" />
|
||||
<package id="NewLife.XCode" version="9.14.2019.923" targetFramework="net461" />
|
||||
<package id="NewLife.Core" version="8.4.2019.1203" targetFramework="net461" />
|
||||
<package id="NewLife.XCode" version="9.14.2019.1203" targetFramework="net461" />
|
||||
</packages>
|
||||
Reference in New Issue
Block a user