FineAdmin.Web/Controllers/LoginController.cs
(开头部分) 3KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using FineAdmin.Common;
using FineAdmin.IService;
using FineAdmin.Model;
using FineAdmin.Web.Areas.SysSet.Models;
namespace FineAdmin.Web.Controllers
{
public class LoginController : Controller
{
public IUserService UserService { get; set; }
public ILogonLogService LogonLogService { get; set; }
// GET: Login
public ActionResult Index()
{
return View(new WebModel().GetWebInfo());
}
[HttpGet]
public ActionResult GetAuthCode()
{
return File(new VerifyCode().GetVerifyCode(), @"image/Gif");
}
[HttpPost]
public ActionResult LoginOn(string username, string password, string captcha)
{
LogonLogModel logEntity = new LogonLogModel();
logEntity.LogType = DbLogType.Login.ToString();
try
{
if (Session["session_verifycode"].IsEmpty() || Md5.md5(captcha.ToLower(), 16) != Session["session_verifycode"].ToString())
{
throw new Exception("验证码错误");
}
UserModel userEntity = UserService.LoginOn(username, Md5.md5(password, 32));
if (userEntity != null)
{
if (userEntity.EnabledMark==1)
{
throw new Exception("账号被锁定,禁止登录");
}
OperatorModel operatorModel = new OperatorModel();
operatorModel.UserId = userEntity.Id;
operatorModel.Account = userEntity.Account;
operatorModel.RealName = userEntity.RealName;
operatorModel.HeadIcon = userEntity.HeadIcon;
operatorModel.RoleId = userEntity.RoleId;
operatorModel.LoginIPAddress = Net.Ip;
operatorModel.LoginIPAddressName = Net.GetLocation(Net.Ip);
OperatorProvider.Provider.AddCurrent(operatorModel);
logEntity.Account = userEntity.Account;
logEntity.RealName = userEntity.RealName;
logEntity.Description = "登陆成功";
LogonLogService.WriteDbLog(logEntity);
return Content(new AjaxResult { state = ResultType.success.ToString(), message = "登录成功" }.ToJson());
}
else
后面还有 30 行代码,解锁后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明
AI 解读
登录后可用,每次 10 积分,解读结果公开显示在下面。
还没有人解读过这个文件。
