AspNet Core MVC项目接入的登录页验证码(二)

基于 SixLabors 实现验证码 

添加登录页login.cshtml

在form表单加入验证码

 

 添加帮助类VCode 生成验证码

 添加 AccountController 中添加生成验证码方法

 

wwwroot/adminlte 文件夹下面加入网上下载的字体文件comic.ttf 设置属性始终复制

 

Dockerfile 中加入复制字体命令

 

添加 Sesssion支持

       builder.Services.AddSession();

  app.UseSession();

检查是否添加静态文件支持

 app.UseStaticFiles();

 

 

 正常发布dotnetcoreweb程序

 

 

上传文件到linux环境之后在走docker发布即可

代码实现:https://github.com/Hedgehogcat/2023/tree/main/Admin/Hedgehogcat.Web.Admin

 SixLabors : https://github.com/SixLabors/ImageSharp

posted @ 2023-05-16 17:10  失去刺猬的猫  阅读(97)  评论(0)    收藏  举报