Download

How does PreLogin modify ErrorMessage reference value after validation permission(Varest) request

How does PreLogin modify the ErrorMessage reference value after the validation permission (using Varest) requested
In PreLogin, you must modify the value of the ErrorMessage reference object to reject the client connection.So I tried the following:
1:
gamemode.h


UFUNCTION(BlueprintImplementableEvent,Category = "CPPGM")
void AuthUser(const FUniqueNetIdRepl& UniqueId,UPARAM(ref) FString& ErrorMessage,const FString& UserToken);
UFUNCTION(BlueprintCallable,Category = "CPPGM") void AuthUserEvent(const FUniqueNetIdRepl& UniqueId,UPARAM(ref) FString& ErrorMessage);


gamemode.cpp



void AMyCPPGM::AuthUserEvent(const FUniqueNetIdRepl& UniqueId,FString& ErrorMessage)
{
if (ErrorMessage.Equals("")) { ErrorMessage = TEXT("Authentication failed!");
}
FGameModeEvents::GameModePreLoginEvent.Broadcast(this, UniqueId, ErrorMessage);
}

void AMyCPPGM::PreLogin(const FString& Options, const FString& Address, const FUniqueNetIdRepl& UniqueId, FString& ErrorMessage)
{ // Super::PreLogin(Options, Address, UniqueId, ErrorMessage); if (NowPlayers>=MaxPlayer)
{ ErrorMessage = TEXT("Plays Full Access denied");
}
const FString password = UGameplayStatics::ParseOption(Options, TEXT("UUID"))
; const FString& token = UGameplayStatics::ParseOption(Options, TEXT("token"));
const bool bUniqueIdCheckOk = (!UniqueId.IsValid() || (UniqueId.GetType() == UOnlineEngineInterface::Get()->GetDefaultOnlineSubsystemName()));
if (bUniqueIdCheckOk && password == UUID)
{ ErrorMessage = GameSession->ApproveLogin(Options);
}
else
{
ErrorMessage = TEXT("Access denied"); UE_LOG(LogTemp,Warning,TEXT("Access denied!!!!!"))
}
if (ErrorMessage.Equals(""))
{
//不为空则上面验证成功,下面进行身份验证,否则直接广播委托回去失败!
//这里的ErrorMessage必须是地址,修改的是地址的内容才有效,修改值是没有效果的
GLog->Log("<<<<<<<<<<<<<<<<"); GLog->Log(ErrorMessage);
// MyReceiveDelegateEvent.ExecuteIfBound(UniqueId,token,ErrorMessage);
this->AuthUser(UniqueId,ErrorMessage,token);
}
else
{
FGameModeEvents::GameModePreLoginEvent.Broadcast(this, UniqueId, ErrorMessage);
}
// FGameModeEvents::GameModePreLoginEvent.Broadcast(this, UniqueId, ErrorMessage);
}

BP:
1.png
The reference does not return a value
You can’t use
2:


Varest requests part


My English is not very good and c++ is not very good, please help me, I would be very grateful, I have spent 3 days on this problem