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 --- WebInterface/NodeJSServer/NodeJSServer.njsproj | 84 ++++++++++++++++++++++++++ WebInterface/NodeJSServer/dist/chat.js | 12 +++- WebInterface/NodeJSServer/dist/index.html | 11 ++-- 3 files changed, 102 insertions(+), 5 deletions(-) create mode 100644 WebInterface/NodeJSServer/NodeJSServer.njsproj (limited to 'WebInterface/NodeJSServer') 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 @@ - + +