add hashed key to log

This commit is contained in:
Stanley Dimant
2024-08-11 15:06:33 +02:00
parent 30f003828e
commit a159a2ac71
2 changed files with 8 additions and 4 deletions

View File

@@ -261,23 +261,24 @@ public partial class MareWizardModule
user.LastLoggedIn = DateTime.UtcNow;
var computedHash = StringUtils.Sha256String(StringUtils.GenerateRandomString(64) + DateTime.UtcNow.ToString());
string hashedKey = StringUtils.Sha256String(computedHash);
var auth = new Auth()
{
HashedKey = StringUtils.Sha256String(computedHash),
HashedKey = hashedKey,
User = user,
};
await db.Users.AddAsync(user).ConfigureAwait(false);
await db.Auth.AddAsync(auth).ConfigureAwait(false);
_botServices.Logger.LogInformation("User registered: {userUID}", user.UID);
lodestoneAuth.StartedAt = null;
lodestoneAuth.User = user;
lodestoneAuth.LodestoneAuthString = null;
await db.SaveChangesAsync().ConfigureAwait(false);
_botServices.Logger.LogInformation("User registered: {userUID}:{hashedKey}", user.UID, hashedKey);
_botServices.DiscordVerifiedUsers.Remove(Context.User.Id, out _);
return (user.UID, computedHash);