ibms-dome/FrontendWebApi/Controllers/LoginController.cs

65 lines
2.0 KiB
C#

using FrontendWebApi.Jwt;
using FrontendWebApi.Models;
using iTextSharp.text;
using iTextSharp.text.pdf;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
using Newtonsoft.Json;
using NPOI.SS.UserModel;
using NPOI.XSSF.UserModel;
using Repository.BackendRepository.Interface;
using Repository.FrontendRepository.Interface;
using Repository.Helper;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Threading.Tasks;
namespace FrontendWebApi.Controllers
{
public class LoginController : Controller
{
private readonly ILogger<LoginController> logger;
private readonly IBackendRepository backendRepository;
private readonly IFrontendRepository frontendRepository;
private readonly IJwtHelpers jwt;
private readonly IDatabaseHelper _base;
//string jwt_str = "login";
protected MyUserInfo myUserInfo = null;
protected JwtGet myUser;
protected string jwt_str = null;
protected bool jwtlife = true;
public LoginController
(
ILogger<LoginController> logger,
IBackendRepository backendRepository,
IFrontendRepository frontendRepository,
IJwtHelpers jwt,
IDatabaseHelper bases
)
{
this.logger = logger;
this.jwt = jwt;
this.backendRepository = backendRepository;
this.frontendRepository = frontendRepository;
_base = bases;
}
public IActionResult GetDB()
{
Response.WriteAsync($"{_base.GetMySqlConnectionString()}");
return View();
}
public IActionResult Index(string jwt)
{
ViewBag.jwt = jwt;
ViewBag.ProjectName = backendRepository.GetOneAsync<string>("select system_key from variable where deleted = 0 and system_type = 'project_name';").Result;
return View();
}
}
}