update v0.0.2 twa sys
This commit is contained in:
@ -1,6 +1,7 @@
|
||||
using AppLibs.Libs;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using TWASys_App.Models;
|
||||
|
||||
namespace TWASys_App.Controllers
|
||||
{
|
||||
@ -13,5 +14,37 @@ namespace TWASys_App.Controllers
|
||||
{
|
||||
return await this.ViewAsync();
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public async Task<IActionResult> SignIn([FromForm] UserModel user)
|
||||
{
|
||||
if (user.Username is not null && user.Password is not null && user.Username.Length > 0 && user.Password.Length > 0)
|
||||
{
|
||||
await Task.Delay(100);
|
||||
if (user.Username.ToLower().Equals("admin") && user.Password.Equals("TWA@2025"))
|
||||
{
|
||||
HttpContext.Session.SetString("userID", "admin");
|
||||
return Json(new MessageHeader
|
||||
{
|
||||
ID = 10003,
|
||||
Message = "Login Success",
|
||||
Status = 1
|
||||
});
|
||||
}
|
||||
return Json(new MessageHeader
|
||||
{
|
||||
ID = 10002,
|
||||
Message = "The username or password you entered is incorrect",
|
||||
Status = 0
|
||||
});
|
||||
}
|
||||
return Json(new MessageHeader
|
||||
{
|
||||
ID = 10001,
|
||||
Message = "The username and password are required",
|
||||
Status = 0
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -67,6 +67,12 @@ namespace TWASys_App.Controllers
|
||||
return await TypeStorageServerModel.GetAllTypeStorage();
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public async Task<IActionResult> GetStorage([FromForm] StorageModel model)
|
||||
{
|
||||
return await model.GetStorages();
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public async Task<IActionResult> GetValidationDomain()
|
||||
{
|
||||
@ -85,6 +91,13 @@ namespace TWASys_App.Controllers
|
||||
return Json(await model.AddAsync());
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public async Task<IActionResult> UpdateStorageSize([FromForm] StorageModel model)
|
||||
{
|
||||
|
||||
return Json(await model.UpdateStorageSize());
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public async Task<IActionResult> GenerationAccessToken()
|
||||
{
|
||||
@ -116,6 +129,19 @@ namespace TWASys_App.Controllers
|
||||
});
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public async Task<IActionResult> CheckStorageInit()
|
||||
{
|
||||
await Task.Delay(1);
|
||||
var f = System.IO.File.Exists(System.IO.Path.GetFullPath("Json/dataServer.json"));
|
||||
return Json(new MessageHeader
|
||||
{
|
||||
ID= 61011,
|
||||
Message=f?"has":"no",
|
||||
Status=1
|
||||
});
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public async Task<IActionResult> GetSysInfo()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user