Exemple #1
0
        private async void HandleLogin(Player source, LoginRpc rpc)
        {
            var result = await database.Query("SELECT * FROM `users` WHERE username = ?", rpc.Username);

            if (result.Length == 0)
            {
                RpcManager.Instance.TriggerRPC(source, "Login.Error", new ErrorRpc("These credentials do not match our records."));
                return;
            }
            var userData = result[0];

            string passwordHash = userData["password"];

            if (!await Bcrypt.Verify(rpc.Password, passwordHash))
            {
                RpcManager.Instance.TriggerRPC(source, "Login.Error", new ErrorRpc("These credentials do not match our records."));
                return;
            }

            RpcManager.Instance.TriggerRPC(source, "Login.Success", new EmptyRpc());
        }
Exemple #2
0
 public void HandleTestRPC(Player p, LoginRpc arguments)
 {
     _ = dbManager.AttemptLogin(p, arguments.username, arguments.password);
 }