public void btnLogin() { if ((ifLogin.text.Length >= GC.MIN_LENGTH) && (ifPassword.text.Length >= GC.MIN_LENGTH)) { PlayerData.Saved.name = ifLogin.text; if (tglRemember.isOn) { if (ifPassword.text != GC.PASS_DUMMY) { string hash = SHA256Hash.HashString(ifPassword.text); if (PlayerData.Saved.passwordHash != hash) { PlayerData.Saved.passwordHash = hash; } } } PlayerData.Saved.remember = tglRemember.isOn; PlayerData.Save(); LoginIO.SendAuthorization( ifLogin.text, ifPassword.text); } else { //TODO visualize the reason of the issue Debug.LogError("Login and/or password to short! Please check if it is OK."); } }
public static void SendRegistration(string name = "test", string email = "test", string password = "******") { var request = new RegistrationRequestDTO(); request.Command = "player/registration"; request.Payload = new RegistrationRequestDTO.Data(); request.Payload.Name = name; request.Payload.Email = email; request.Payload.Password = SHA256Hash.HashString(password); Debug.Log(JsonConvert.SerializeObject(request)); ws.Send(JsonConvert.SerializeObject(request)); }
public static void SendAuthorization(string name = "test", string password = "******") { var request = new AuthorizationRequestDTO(); request.Command = "player/authorization"; request.Payload = new AuthorizationRequestDTO.Data(); request.Payload.Name = name; Debug.Log(password.Length); if (password == GC.PASS_DUMMY) { request.Payload.Password = PlayerData.Saved.passwordHash; } else { request.Payload.Password = SHA256Hash.HashString(password); } Debug.Log(JsonConvert.SerializeObject(request)); ws.Send(JsonConvert.SerializeObject(request)); }