Prevent access to GameServer features if email enforcement is enabled and email is unverified

This commit is contained in:
FeTetra 2024-12-17 02:19:53 -05:00
commit 9e9c96e1a3
3 changed files with 36 additions and 0 deletions

View file

@ -25,6 +25,8 @@ public class MatchController : ControllerBase
{
private readonly DatabaseContext database;
private static readonly bool emailEnforcementEnabled = EnforceEmailConfiguration.Instance.EnableEmailEnforcement;
public MatchController(DatabaseContext database)
{
this.database = database;
@ -43,6 +45,8 @@ public class MatchController : ControllerBase
UserEntity? user = await this.database.UserFromGameToken(token);
if (user == null) return this.Forbid();
if (emailEnforcementEnabled && !user.EmailAddressVerified) return this.BadRequest();
await LastContactHelper.SetLastContact(this.database, user, token.GameVersion, token.Platform);
// Do not allow matchmaking if it has been disabled