Move everything into middleware

This commit is contained in:
FeTetra 2025-02-16 19:34:15 -05:00
commit 561e1d4e26
8 changed files with 93 additions and 62 deletions

View file

@ -25,8 +25,6 @@ public class MatchController : ControllerBase
{
private readonly DatabaseContext database;
private static readonly bool emailEnforcementEnabled = EnforceEmailConfiguration.Instance.EnableEmailEnforcement;
public MatchController(DatabaseContext database)
{
this.database = database;
@ -44,9 +42,6 @@ public class MatchController : ControllerBase
UserEntity? user = await this.database.UserFromGameToken(token);
if (user == null) return this.Unauthorized();
// Return bad request on unverified email if enforcement is enabled
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