This commit is contained in:
15
.vscode/launch.json
vendored
15
.vscode/launch.json
vendored
@@ -13,6 +13,21 @@
|
|||||||
"program": "${workspaceFolder}/bin/Debug/netcoreapp2.2/qbridge.dll",
|
"program": "${workspaceFolder}/bin/Debug/netcoreapp2.2/qbridge.dll",
|
||||||
"args": [],
|
"args": [],
|
||||||
"cwd": "${workspaceFolder}",
|
"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,
|
"stopAtEntry": false,
|
||||||
// Enable launching a web browser when ASP.NET Core starts. For more information: https://aka.ms/VSCode-CS-LaunchJson-WebBrowser
|
// Enable launching a web browser when ASP.NET Core starts. For more information: https://aka.ms/VSCode-CS-LaunchJson-WebBrowser
|
||||||
"serverReadyAction": {
|
"serverReadyAction": {
|
||||||
|
|||||||
@@ -10,10 +10,10 @@ namespace qbridge.Controllers
|
|||||||
[Route("api/[controller]")]
|
[Route("api/[controller]")]
|
||||||
[ApiController]
|
[ApiController]
|
||||||
[Produces("application/json")]
|
[Produces("application/json")]
|
||||||
public class BridgeController : ControllerBase
|
public class AuthController : ControllerBase
|
||||||
{
|
{
|
||||||
|
|
||||||
public BridgeController()
|
public AuthController()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
90
Controllers/QBridgeController.cs
Normal file
90
Controllers/QBridgeController.cs
Normal 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; }
|
||||||
|
// }
|
||||||
|
// *************************************************************************************************************
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user