This commit is contained in:
2019-09-23 18:20:48 +00:00
parent a396bfed80
commit 34cfc89d0b
3 changed files with 107 additions and 2 deletions

15
.vscode/launch.json vendored
View File

@@ -13,6 +13,21 @@
"program": "${workspaceFolder}/bin/Debug/netcoreapp2.2/qbridge.dll",
"args": [],
"cwd": "${workspaceFolder}",
"launchBrowser": {
"enabled": true,
//"args": "${auto-detect-url}/auth/",
"windows": {
"command": "cmd.exe",
//"args": "/C start http://localhost:7575/api/v8/"
"args": "/C start ${auto-detect-url}/qbridge/",
},
"osx": {
"command": "open"
},
"linux": {
"command": "xdg-open"
}
},
"stopAtEntry": false,
// Enable launching a web browser when ASP.NET Core starts. For more information: https://aka.ms/VSCode-CS-LaunchJson-WebBrowser
"serverReadyAction": {

View File

@@ -10,10 +10,10 @@ namespace qbridge.Controllers
[Route("api/[controller]")]
[ApiController]
[Produces("application/json")]
public class BridgeController : ControllerBase
public class AuthController : ControllerBase
{
public BridgeController()
public AuthController()
{
}

View File

@@ -0,0 +1,90 @@
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; }
// }
// *************************************************************************************************************
}
}