StudentManageSystem/Controllers/LoginController.cs
(开头部分) 6KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
using System;
using System.Security.Claims;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Authentication;
using Microsoft.AspNetCore.Authentication.Cookies;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
using Student.DTO.Login;
using StudentManageSystem.HttpApis;
using StudentManageSystem.ViewModels;
using yrjw.CommonToolsCore.Helper;
namespace StudentManageSystem.Controllers
{
public class LoginController : Controller
{
private readonly ILogger<LoginController> _logger;
public readonly IAuthApi _authApi;
public readonly IConfigApi _configApi;
public LoginController(ILogger<LoginController> logger, IAuthApi authApi, IConfigApi configApi)
{
_logger = logger;
_authApi = authApi;
_configApi = configApi;
}
public async Task<IActionResult> IndexAsync()
{
var model = new LoginViewModel() { userid = TempData["userid"]?.ToString() };
ViewBag.VerifyCode = await getVerifyCode();
return View(model);
}
/// <summary>
/// 启用验证码控制
/// </summary>
/// <returns></returns>
private async Task<bool> getVerifyCode()
{
var config = await _configApi.QueryAuthAsync();
if (config.Success)
{
if (config.Data.Code.EqualsIgnoreCase("Auth"))
{
var authConfig = config.Data.Value.ToJson<Auth.Jwt.AuthConfigData>();
return authConfig.VerifyCode;
}
}
return false;
}
[HttpPost]
[ValidateAntiForgeryToken]
public async Task<IActionResult> Index(LoginViewModel vModel)
{
ViewBag.VerifyCode = await getVerifyCode();
if (ModelState.IsValid)
{
后面还有 90 行代码,解锁后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。