Changed login procedure
This commit is contained in:
@@ -139,15 +139,12 @@ namespace ErgometerLibrary
|
|||||||
private static NetCommand ParseLoginRequest(int session, string[] args)
|
private static NetCommand ParseLoginRequest(int session, string[] args)
|
||||||
{
|
{
|
||||||
bool doctor = bool.Parse(args[1]);
|
bool doctor = bool.Parse(args[1]);
|
||||||
if (doctor && args.Length != 3)
|
if (args.Length != 3)
|
||||||
throw new MissingFieldException("Error in NetCommand: Doctor login is missing arguments");
|
throw new MissingFieldException("Error in NetCommand: Doctor login is missing arguments");
|
||||||
else if (args.Length != 2)
|
|
||||||
throw new MissingFieldException("Error in NetCommand: Client login is missing arguments");
|
|
||||||
|
|
||||||
NetCommand temp = new NetCommand(CommandType.LOGIN, session);
|
NetCommand temp = new NetCommand(CommandType.LOGIN, session);
|
||||||
temp.IsDoctor = doctor;
|
temp.IsDoctor = doctor;
|
||||||
temp.DisplayName = args[0];
|
temp.DisplayName = args[0];
|
||||||
if (doctor)
|
|
||||||
temp.Password = args[2];
|
temp.Password = args[2];
|
||||||
|
|
||||||
return temp;
|
return temp;
|
||||||
@@ -160,7 +157,7 @@ namespace ErgometerLibrary
|
|||||||
switch (Type)
|
switch (Type)
|
||||||
{
|
{
|
||||||
case CommandType.LOGIN:
|
case CommandType.LOGIN:
|
||||||
command += "1»ses" + Session + "»" + DisplayName + "»" + IsDoctor + (IsDoctor ? "»" + Password : "");
|
command += "1»ses" + Session + "»" + DisplayName + "»" + IsDoctor + "»" + Password;
|
||||||
break;
|
break;
|
||||||
case CommandType.DATA:
|
case CommandType.DATA:
|
||||||
command += "2»ses" + Session + "»" + Meting.ToCommand();
|
command += "2»ses" + Session + "»" + Meting.ToCommand();
|
||||||
|
|||||||
Reference in New Issue
Block a user