From 9aa97350b7144181c075aec5d44b818a74f2b7e8 Mon Sep 17 00:00:00 2001 From: Dennis Kobert Date: Fri, 28 Sep 2018 15:27:00 +0200 Subject: added client side group authentification --- DiscoBot.sln | 32 +++++++--- WebInterface/NodeJSServer/NodeJSServer.njsproj | 84 ++++++++++++++++++++++++++ WebInterface/NodeJSServer/dist/chat.js | 12 +++- WebInterface/NodeJSServer/dist/index.html | 11 ++-- 4 files changed, 127 insertions(+), 12 deletions(-) create mode 100644 WebInterface/NodeJSServer/NodeJSServer.njsproj diff --git a/DiscoBot.sln b/DiscoBot.sln index 7aab504..0ac2cf2 100644 --- a/DiscoBot.sln +++ b/DiscoBot.sln @@ -7,11 +7,29 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DiscoBot", "DiscoBot\DiscoB EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ZooBOTanica", "ZooBOTanica\ZooBOTanica.csproj", "{58917D99-DC94-4CDD-AD2B-C6E0BAFFCF47}" EndProject -Project("{9092AA53-FB77-4645-B42D-1CCCA6BD08BD}") = "NodeJSServer", "NodeJSServer\NodeJSServer.njsproj", "{57064377-C08C-4218-9C55-0552D40F3877}" -EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DSALib", "DSALib\DSALib.csproj", "{388DD4ED-29C4-4127-AC8F-34DD3FE9F9B0}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DSACore", "DSACore\DSACore.csproj", "{35A5E2CC-0FD4-4BC0-ACBF-38599CAED1C4}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DSACore", "DSACore\DSACore.csproj", "{35A5E2CC-0FD4-4BC0-ACBF-38599CAED1C4}" +EndProject +Project("{E24C65DC-7377-472B-9ABA-BC803B73C61A}") = "WebInterface", "WebInterface\", "{9B03E3A4-E233-41DF-AC13-BED4812B3D27}" + ProjectSection(WebsiteProperties) = preProject + TargetFrameworkMoniker = ".NETFramework,Version%3Dv4.0" + Debug.AspNetCompiler.VirtualPath = "/localhost_3664" + Debug.AspNetCompiler.PhysicalPath = "WebInterface\" + Debug.AspNetCompiler.TargetPath = "PrecompiledWeb\localhost_3664\" + Debug.AspNetCompiler.Updateable = "true" + Debug.AspNetCompiler.ForceOverwrite = "true" + Debug.AspNetCompiler.FixedNames = "false" + Debug.AspNetCompiler.Debug = "True" + Release.AspNetCompiler.VirtualPath = "/localhost_3664" + Release.AspNetCompiler.PhysicalPath = "WebInterface\" + Release.AspNetCompiler.TargetPath = "PrecompiledWeb\localhost_3664\" + Release.AspNetCompiler.Updateable = "true" + Release.AspNetCompiler.ForceOverwrite = "true" + Release.AspNetCompiler.FixedNames = "false" + Release.AspNetCompiler.Debug = "False" + VWDPort = "3664" + EndProjectSection EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -27,10 +45,6 @@ Global {58917D99-DC94-4CDD-AD2B-C6E0BAFFCF47}.Debug|Any CPU.Build.0 = Debug|Any CPU {58917D99-DC94-4CDD-AD2B-C6E0BAFFCF47}.Release|Any CPU.ActiveCfg = Release|Any CPU {58917D99-DC94-4CDD-AD2B-C6E0BAFFCF47}.Release|Any CPU.Build.0 = Release|Any CPU - {57064377-C08C-4218-9C55-0552D40F3877}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {57064377-C08C-4218-9C55-0552D40F3877}.Debug|Any CPU.Build.0 = Debug|Any CPU - {57064377-C08C-4218-9C55-0552D40F3877}.Release|Any CPU.ActiveCfg = Release|Any CPU - {57064377-C08C-4218-9C55-0552D40F3877}.Release|Any CPU.Build.0 = Release|Any CPU {388DD4ED-29C4-4127-AC8F-34DD3FE9F9B0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {388DD4ED-29C4-4127-AC8F-34DD3FE9F9B0}.Debug|Any CPU.Build.0 = Debug|Any CPU {388DD4ED-29C4-4127-AC8F-34DD3FE9F9B0}.Release|Any CPU.ActiveCfg = Release|Any CPU @@ -39,6 +53,10 @@ Global {35A5E2CC-0FD4-4BC0-ACBF-38599CAED1C4}.Debug|Any CPU.Build.0 = Debug|Any CPU {35A5E2CC-0FD4-4BC0-ACBF-38599CAED1C4}.Release|Any CPU.ActiveCfg = Release|Any CPU {35A5E2CC-0FD4-4BC0-ACBF-38599CAED1C4}.Release|Any CPU.Build.0 = Release|Any CPU + {9B03E3A4-E233-41DF-AC13-BED4812B3D27}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {9B03E3A4-E233-41DF-AC13-BED4812B3D27}.Debug|Any CPU.Build.0 = Debug|Any CPU + {9B03E3A4-E233-41DF-AC13-BED4812B3D27}.Release|Any CPU.ActiveCfg = Debug|Any CPU + {9B03E3A4-E233-41DF-AC13-BED4812B3D27}.Release|Any CPU.Build.0 = Debug|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/WebInterface/NodeJSServer/NodeJSServer.njsproj b/WebInterface/NodeJSServer/NodeJSServer.njsproj new file mode 100644 index 0000000..6181774 --- /dev/null +++ b/WebInterface/NodeJSServer/NodeJSServer.njsproj @@ -0,0 +1,84 @@ + + + + Debug + 2.0 + {687040f4-1ffd-41aa-b4ca-e132a3d1fb15} + . + ShowAllFiles + webpack.config.js + . + . + {3AF33F2E-1136-4D97-BBB7-1795711AC8B8};{349c5851-65df-11da-9384-00065b846f21};{9092AA53-FB77-4645-B42D-1CCCA6BD08BD} + 14.0 + $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + False + True + 0 + / + http://localhost:48022/ + False + True + http://localhost:1337 + False + + + + + + + CurrentPage + True + False + False + False + + + + + + + + + False + False + + + + + \ No newline at end of file diff --git a/WebInterface/NodeJSServer/dist/chat.js b/WebInterface/NodeJSServer/dist/chat.js index 6832cc2..1be6fbc 100644 --- a/WebInterface/NodeJSServer/dist/chat.js +++ b/WebInterface/NodeJSServer/dist/chat.js @@ -14,10 +14,20 @@ connection.start().catch(function (err) { return console.error(err.toString()); }); +document.getElementById("loginButton").addEventListener("click", function (event) { + var group = document.getElementById("userInput").value; + var password = document.getElementById("messageInput").value; + connection.invoke("Login", group, password).catch(function (err) { + return console.error(err.toString()); + }); + event.preventDefault(); +}); + document.getElementById("sendButton").addEventListener("click", function (event) { var user = document.getElementById("userInput").value; var message = document.getElementById("messageInput").value; - connection.invoke("SendMessage", user, message).catch(function (err) { + var group = "TheCrew"; + connection.invoke("SendMessage",group, user, message).catch(function (err) { return console.error(err.toString()); }); event.preventDefault(); diff --git a/WebInterface/NodeJSServer/dist/index.html b/WebInterface/NodeJSServer/dist/index.html index 4264b39..d54470c 100644 --- a/WebInterface/NodeJSServer/dist/index.html +++ b/WebInterface/NodeJSServer/dist/index.html @@ -1,4 +1,4 @@ - + @@ -42,9 +42,12 @@ - + +