fix(auth): replace HMAC token generation with SHA256 for email verification

the HMAC is intended for other actions like change email, i just forgot and was rushing at the time, whoops!
This commit is contained in:
2026-03-07 17:56:06 -05:00
parent 12f716eb83
commit 49e73cde9c
+2 -2
View File
@@ -233,7 +233,7 @@ namespace SharpbinV3.Server.Services
} }
string token = Utilities.GenerateSecureRandomString(EmailVerificationTokenLength); string token = Utilities.GenerateSecureRandomString(EmailVerificationTokenLength);
string tokenHash = Utilities.ComputeHmacSha256(token, _emailSettings.Verification_HMAC_Secret); string tokenHash = Utilities.ComputeSha256(token);
await _email.SendAsync( await _email.SendAsync(
user.Email, user.Email,
@@ -259,7 +259,7 @@ namespace SharpbinV3.Server.Services
if (string.IsNullOrWhiteSpace(_emailSettings.Verification_HMAC_Secret)) if (string.IsNullOrWhiteSpace(_emailSettings.Verification_HMAC_Secret))
return (false, "Email verification is not configured."); return (false, "Email verification is not configured.");
string tokenHash = Utilities.ComputeHmacSha256(token, _emailSettings.Verification_HMAC_Secret); string tokenHash = Utilities.ComputeSha256(token);
var verificationToken = await _db.EmailVerificationTokens.Include(t => t.User).FirstOrDefaultAsync(t => t.TokenHash == tokenHash); var verificationToken = await _db.EmailVerificationTokens.Include(t => t.User).FirstOrDefaultAsync(t => t.TokenHash == tokenHash);
if ( if (