Files
qbridge/Controllers/QBridgeController.cs
2019-09-23 18:20:48 +00:00

90 lines
2.6 KiB
C#

using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace qbridge.Controllers
{
[Route("[controller]")]
[ApiController]
[Produces("application/json")]
public class QBridgeController : ControllerBase
{
public QBridgeController()
{
}
[HttpGet]
public ContentResult Index()
{
var errorBlock = string.Empty;
var resp = $@"<html lang=""en"">
<head>
<meta charset=""utf-8"">
<meta name=""viewport"" content=""width=device-width, initial-scale=1, shrink-to-fit=no"">
<title>AyaNova QBOI bridge authorization server</title>
<script src=/jquery-1.9.1.js></script>
</head>
<body >
<div style=""text-align: center;"">
{errorBlock}
<div style=""display: inline-block;text-align:left;"">
<h1>QBOI Bridge</h1>
<form action=""/QBridge"" method=""post"">
<div class=""container"">
<div>
<label for=""uname""><b>User name</b></label>
<input type=""text"" placeholder=""Enter Username"" id=""uname"" name=""uname"" required>
</div>
<div>
<label for=""pwd""><b>Password</b></label>
<input type=""password"" placeholder=""Enter Password"" id=""pwd"" name=""pwd"" required>
</div>
<button type=""submit"">Login</button>
</div>
</form>
</div>
</div>
</body>
</html>";
return new ContentResult
{
ContentType = "text/html",
StatusCode = 200,
Content = resp
};
}
[HttpPost]
public IActionResult Index([FromForm]string uname,[FromForm]string pwd)
{
return Content($"Hello {uname}, password: {pwd}");
}
// public class CBUserModel
// {
// [Required(ErrorMessage = "UserName is required")]
// public string UserName { get; set; }
// [Required(ErrorMessage = "Password is required")]
// [DataType(DataType.Password)]
// public string Password { get; set; }
// }
// *************************************************************************************************************
}
}