set doctor of communication when doctor logs in
This commit is contained in:
@@ -236,7 +236,7 @@ namespace DoctorApp.Utils
|
||||
string hashUser = Hashing.Hasher.HashString(username);
|
||||
string hashPassword = Hashing.Hasher.HashString(password);
|
||||
|
||||
byte[] message = DataParser.getJsonMessage(DataParser.GetLoginJson(hashUser, hashPassword));
|
||||
byte[] message = DataParser.getJsonMessage(DataParser.LoginAsDoctor(hashUser, hashPassword));
|
||||
|
||||
|
||||
this.stream.BeginWrite(message, 0, message.Length, new AsyncCallback(OnWrite), null);
|
||||
|
||||
@@ -17,6 +17,7 @@ namespace DoctorApp.Utils
|
||||
public const string SET_RESISTANCE = "SET RESISTANCE";
|
||||
public const string NEW_CONNECTION = "NEW CONNECTION";
|
||||
public const string DISCONNECT = "DISCONNECT";
|
||||
public const string LOGIN_DOCTOR = "LOGIN DOCTOR";
|
||||
/// <summary>
|
||||
/// makes the json object with LOGIN identifier and username and password
|
||||
/// </summary>
|
||||
@@ -38,6 +39,21 @@ namespace DoctorApp.Utils
|
||||
return Encoding.ASCII.GetBytes(JsonConvert.SerializeObject(json));
|
||||
}
|
||||
|
||||
public static byte[] LoginAsDoctor(string mUsername, string mPassword)
|
||||
{
|
||||
dynamic json = new
|
||||
{
|
||||
identifier = LOGIN_DOCTOR,
|
||||
data = new
|
||||
{
|
||||
username = mUsername,
|
||||
password = mPassword,
|
||||
}
|
||||
};
|
||||
|
||||
return Encoding.ASCII.GetBytes(JsonConvert.SerializeObject(json));
|
||||
}
|
||||
|
||||
public static bool GetUsernamePassword(byte[] jsonbytes, out string username, out string password)
|
||||
{
|
||||
dynamic json = JsonConvert.DeserializeObject(Encoding.ASCII.GetString(jsonbytes));
|
||||
|
||||
Reference in New Issue
Block a user