Bläddra i källkod

Fixed bug in login. Incoming message should end with "|"

jancoow 10 år sedan
förälder
incheckning
d6b32f2480

+ 3 - 1
Proftaak Remote Healthcare/Server/AppGlobal.cs

@@ -2,6 +2,7 @@
 using System.Threading;
 using Fietsclient;
 using System.Threading.Tasks;
+using System;
 
 namespace Server
 {
@@ -21,6 +22,7 @@ namespace Server
         private AppGlobal()
         {
             users = new List<User>();
+            users.Add(new User("no", "no", "no", false));
             users.Add(new User("Janco Kock", "jancoow", "test", true));
             users.Add(new User("Tom Remeeus", "tommie", "jemoeder", false));
         }
@@ -31,7 +33,7 @@ namespace Server
             admin = 0;
             foreach (User u in users)
             {
-                if(u.name == username && u.password == password)
+                if (u.username == username && u.password == password)
                 {
                     admin = u.admin ? 1 : 0;
                     id = users.IndexOf(u);

+ 3 - 3
Proftaak Remote Healthcare/Server/client.cs → Proftaak Remote Healthcare/Server/Client.cs

@@ -36,17 +36,17 @@ namespace Server
                     switch (response_parts[0])
                     {
                         case "0":   //login
-                            if (response_parts.Length == 3) { 
+                            if (response_parts.Length == 4) {
                                 int admin, id;
                                 _global.CheckLogin(response_parts[1], response_parts[2], out admin, out id);
                                 if(id > -1)
                                 {
                                     this.iduser = id;
-                                    sendString("0|" + id + "|" + admin);
+                                    sendString("0|" + id + "|" + admin + "|" );
                                 }
                                 else
                                 {
-                                    sendString("0|0|0");
+                                    sendString("0|0|0|");
                                 }
                             }
                             break;

+ 6 - 0
Proftaak Remote Healthcare/Server/Server.csproj

@@ -52,6 +52,12 @@
   <ItemGroup>
     <None Include="App.config" />
   </ItemGroup>
+  <ItemGroup>
+    <ProjectReference Include="..\Fietsclient\Fietsclient.csproj">
+      <Project>{49668592-ed5d-4907-9ea7-2df70ab96271}</Project>
+      <Name>Fietsclient</Name>
+    </ProjectReference>
+  </ItemGroup>
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
   <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
        Other similar extension points exist, see Microsoft.Common.targets.