Tweak code command

This commit is contained in:
zheneq 2026-08-02 13:58:18 +04:00
parent ff68b0f60b
commit a12085e277
2 changed files with 14 additions and 2 deletions

View file

@ -139,6 +139,15 @@ namespace EvoS.DirectoryServer.Account
registrationCodeEntry = e;
}
else if (code is not null)
{
// consume the registration code if it exists even if it is not required
RegistrationCodeDao.RegistrationCodeEntry e = registrationCodeDao.Find(code);
if (e is not null && e.IsValid && e.IssuedTo.Equals(username.ToLower()))
{
registrationCodeEntry = e;
}
}
long accountId = GenerateAccountId(username);
for (int i = 0; loginDao.Find(accountId) != null; ++i)

View file

@ -383,9 +383,12 @@ namespace CentralServer.LobbyServer.Discord
return;
}
if (entry.IsUsed)
LoginDao.LoginEntry loginEntry = DB.Get().LoginDao.Find(entry.IssuedTo);
if (entry.IsUsed || loginEntry is not null)
{
await command.RespondAsync("You have already registered an account.", ephemeral: true);
await command.RespondAsync(
$"You have already registered `{loginEntry?.Username ?? entry.IssuedTo}`. Log in with your username and password.",
ephemeral: true);
return;
}