Пример #1
0
        public void OnTryLogin(SvManager svManager, AuthData authData, ConnectData connectData)
        {
            if (ValidateUser(svManager, authData))
            {
                if (!svManager.TryGetUserData(authData.accountID, out User playerData))
                {
                    svManager.RegisterFail(authData.connection, "Account not found - Please Register");
                    return;
                }

                if (playerData.BanInfo.IsBanned)
                {
                    svManager.RegisterFail(authData.connection, $"Account banned: {playerData.BanInfo.Reason}");
                    return;
                }

                if (!svManager.settings.auth.steam && playerData.PasswordHash != connectData.passwordHash)
                {
                    svManager.RegisterFail(authData.connection, $"Invalid credentials");
                    return;
                }

                svManager.LoadSavedPlayer(playerData, authData, connectData);
            }
        }
Пример #2
0
        public void OnTryLogin(SvManager svManager, ConnectionData connectionData)
        {
            if (ValidateUser(svManager, connectionData))
            {
                if (!svManager.TryGetUserData(connectionData.username, out var playerData))
                {
                    svManager.RegisterFail(connectionData.connection, "Account not found - Please Register");
                    return;
                }

                if (playerData.PasswordHash != connectionData.passwordHash)
                {
                    svManager.RegisterFail(connectionData.connection, "Invalid credentials");
                    return;
                }

                svManager.LoadSavedPlayer(playerData, connectionData);
            }
        }